Package com.swiftmq.net.client
Class BlockingConnection
- java.lang.Object
-
- java.lang.Thread
-
- com.swiftmq.net.client.BlockingConnection
-
- All Implemented Interfaces:
Connection,ChunkListener,OutputListener,java.lang.Runnable
public class BlockingConnection extends java.lang.Thread implements Connection, ChunkListener, OutputListener
-
-
Constructor Summary
Constructors Constructor Description BlockingConnection(java.net.Socket socket, int inputBufferSize, int inputExtendSize, int outputBufferSize, int outputExtendSize)BlockingConnection(java.net.Socket socket, InboundHandler inboundHandler, ExceptionHandler exceptionHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchunkCompleted(byte[] b, int offset, int len)Called from a ProtocolInputHandler when a protocol-chunk has been completed.voidclose()protected ProtocolInputHandlercreateInputHandler()protected ProtocolOutputHandlercreateOutputHandler(int outputBufferSize, int outputExtendSize)java.lang.StringgetHostname()java.lang.StringgetLocalHostname()java.io.OutputStreamgetOutputStream()intgetPort()intperformWrite(byte[] b, int offset, int len)Performs the write to the network.voidrun()voidsetExceptionHandler(ExceptionHandler exceptionHandler)voidsetInboundHandler(InboundHandler inboundHandler)voidsetInputActiveIndicator(java.util.concurrent.atomic.AtomicBoolean inputActiveIndicator)java.lang.StringtoString()-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, yield
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.swiftmq.net.client.Connection
start
-
-
-
-
Constructor Detail
-
BlockingConnection
public BlockingConnection(java.net.Socket socket, InboundHandler inboundHandler, ExceptionHandler exceptionHandler) throws java.io.IOException- Throws:
java.io.IOException
-
BlockingConnection
public BlockingConnection(java.net.Socket socket, int inputBufferSize, int inputExtendSize, int outputBufferSize, int outputExtendSize) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
createOutputHandler
protected ProtocolOutputHandler createOutputHandler(int outputBufferSize, int outputExtendSize)
-
createInputHandler
protected ProtocolInputHandler createInputHandler()
-
setInputActiveIndicator
public void setInputActiveIndicator(java.util.concurrent.atomic.AtomicBoolean inputActiveIndicator)
- Specified by:
setInputActiveIndicatorin interfaceConnection
-
chunkCompleted
public void chunkCompleted(byte[] b, int offset, int len)Description copied from interface:ChunkListenerCalled from a ProtocolInputHandler when a protocol-chunk has been completed.- Specified by:
chunkCompletedin interfaceChunkListener- Parameters:
b- byte array.offset- offsetlen- length
-
performWrite
public int performWrite(byte[] b, int offset, int len) throws java.io.IOExceptionDescription copied from interface:OutputListenerPerforms the write to the network.- Specified by:
performWritein interfaceOutputListener- Parameters:
b- byte array.offset- offset.len- length.- Returns:
- number of bytes written.
- Throws:
java.io.IOException- on error.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
setInboundHandler
public void setInboundHandler(InboundHandler inboundHandler)
- Specified by:
setInboundHandlerin interfaceConnection
-
setExceptionHandler
public void setExceptionHandler(ExceptionHandler exceptionHandler)
- Specified by:
setExceptionHandlerin interfaceConnection
-
getLocalHostname
public java.lang.String getLocalHostname()
- Specified by:
getLocalHostnamein interfaceConnection
-
getHostname
public java.lang.String getHostname()
- Specified by:
getHostnamein interfaceConnection
-
getPort
public int getPort()
- Specified by:
getPortin interfaceConnection
-
getOutputStream
public java.io.OutputStream getOutputStream()
- Specified by:
getOutputStreamin interfaceConnection
-
close
public void close()
- Specified by:
closein interfaceConnection
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Thread
-
-