Package com.swiftmq.net.client
Class BlockingConnection
java.lang.Object
java.lang.Thread
com.swiftmq.net.client.BlockingConnection
- All Implemented Interfaces:
Connection
,ChunkListener
,OutputListener
,Runnable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionBlockingConnection
(Socket socket, int inputBufferSize, int inputExtendSize, int outputBufferSize, int outputExtendSize) BlockingConnection
(Socket socket, InboundHandler inboundHandler, ExceptionHandler exceptionHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
chunkCompleted
(byte[] b, int offset, int len) Called from a ProtocolInputHandler when a protocol-chunk has been completed.void
close()
protected ProtocolInputHandler
protected ProtocolOutputHandler
createOutputHandler
(int outputBufferSize, int outputExtendSize) int
getPort()
int
performWrite
(byte[] b, int offset, int len) Performs the write to the network.void
run()
void
setExceptionHandler
(ExceptionHandler exceptionHandler) void
setInboundHandler
(InboundHandler inboundHandler) void
setInputActiveIndicator
(AtomicBoolean inputActiveIndicator) toString()
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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, 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 Details
-
BlockingConnection
public BlockingConnection(Socket socket, InboundHandler inboundHandler, ExceptionHandler exceptionHandler) throws IOException - Throws:
IOException
-
BlockingConnection
public BlockingConnection(Socket socket, int inputBufferSize, int inputExtendSize, int outputBufferSize, int outputExtendSize) throws IOException - Throws:
IOException
-
-
Method Details
-
createOutputHandler
-
createInputHandler
-
setInputActiveIndicator
- Specified by:
setInputActiveIndicator
in interfaceConnection
-
chunkCompleted
public void chunkCompleted(byte[] b, int offset, int len) Description copied from interface:ChunkListener
Called from a ProtocolInputHandler when a protocol-chunk has been completed.- Specified by:
chunkCompleted
in interfaceChunkListener
- Parameters:
b
- byte array.offset
- offsetlen
- length
-
performWrite
Description copied from interface:OutputListener
Performs the write to the network.- Specified by:
performWrite
in interfaceOutputListener
- Parameters:
b
- byte array.offset
- offset.len
- length.- Returns:
- number of bytes written.
- Throws:
IOException
- on error.
-
run
public void run() -
setInboundHandler
- Specified by:
setInboundHandler
in interfaceConnection
-
setExceptionHandler
- Specified by:
setExceptionHandler
in interfaceConnection
-
getLocalHostname
- Specified by:
getLocalHostname
in interfaceConnection
-
getHostname
- Specified by:
getHostname
in interfaceConnection
-
getPort
public int getPort()- Specified by:
getPort
in interfaceConnection
-
getOutputStream
- Specified by:
getOutputStream
in interfaceConnection
-
close
public void close()- Specified by:
close
in interfaceConnection
-
toString
-