- java.lang.Object
-
- org.snmp4j.transport.AbstractTcpServerThread<TLSTM.SocketEntry>
-
- org.snmp4j.transport.TLSTM.ServerThread
-
- All Implemented Interfaces:
java.lang.Runnable,WorkerTask
- Enclosing class:
- TLSTM
class TLSTM.ServerThread extends AbstractTcpServerThread<TLSTM.SocketEntry>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.BlockingQueue<TLSTM.SocketEntry>inQueueprivate java.lang.ThrowablelastErrorprivate java.util.concurrent.BlockingQueue<TLSTM.SocketEntry>outQueueprivate java.nio.channels.ServerSocketChannelssc-
Fields inherited from class org.snmp4j.transport.AbstractTcpServerThread
pending, selector, stop, tcpTransportMapping
-
-
Constructor Summary
Constructors Constructor Description ServerThread()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcloseChannelAndRemoveSocket(TLSTM.SocketEntry entry, java.io.IOException ioException)private voiddispatchMessage(TcpAddress incomingAddress, java.nio.ByteBuffer byteBuffer, long bytesRead, java.lang.Object sessionID, TransportStateReference tmStateReference)java.lang.ThrowablegetLastError()private booleanisConnectionClosed(TLSTM.SocketEntry entry, java.io.IOException ioException)private voidprocessPending()private voidprocessQueues()private voidreadMessage(java.nio.channels.SelectionKey sk, java.nio.channels.SocketChannel readChannel, TcpAddress incomingAddress, TLSTM.SocketEntry session)TLSTM.SocketEntryremoveSocketEntry(TcpAddress incomingAddress)voidrun()booleanrunDelegatedTasks(javax.net.ssl.SSLEngineResult result, TLSTM.SocketEntry entry)If the result indicates that we have outstanding tasks to do, go ahead and run them in this thread.voidsendMessage(Address address, byte[] message, TransportStateReference tmStateReference)protected TcpAddresswriteData(java.nio.channels.SelectionKey sk, TcpAddress incomingAddress)private voidwriteMessage(TLSTM.SocketEntry entry, java.nio.channels.SocketChannel sc)-
Methods inherited from class org.snmp4j.transport.AbstractTcpServerThread
close, closeChannel, connectChannel, connectSocketToSendMessage, interrupt, join, terminate
-
-
-
-
Field Detail
-
lastError
private java.lang.Throwable lastError
-
ssc
private java.nio.channels.ServerSocketChannel ssc
-
outQueue
private final java.util.concurrent.BlockingQueue<TLSTM.SocketEntry> outQueue
-
inQueue
private final java.util.concurrent.BlockingQueue<TLSTM.SocketEntry> inQueue
-
-
Method Detail
-
processQueues
private void processQueues()
-
isConnectionClosed
private boolean isConnectionClosed(TLSTM.SocketEntry entry, java.io.IOException ioException)
-
closeChannelAndRemoveSocket
private void closeChannelAndRemoveSocket(TLSTM.SocketEntry entry, java.io.IOException ioException)
-
processPending
private void processPending()
-
runDelegatedTasks
public boolean runDelegatedTasks(javax.net.ssl.SSLEngineResult result, TLSTM.SocketEntry entry) throws java.io.IOExceptionIf the result indicates that we have outstanding tasks to do, go ahead and run them in this thread.- Parameters:
result- the SSLEngine wrap/unwrap result.entry- the session to use.- Returns:
trueif processing of delegated tasks has been finished,falseotherwise.- Throws:
java.io.IOException
-
getLastError
public java.lang.Throwable getLastError()
-
sendMessage
public void sendMessage(Address address, byte[] message, TransportStateReference tmStateReference) throws java.io.IOException
- Throws:
java.io.IOException
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin classAbstractTcpServerThread<TLSTM.SocketEntry>
-
removeSocketEntry
public TLSTM.SocketEntry removeSocketEntry(TcpAddress incomingAddress)
- Specified by:
removeSocketEntryin classAbstractTcpServerThread<TLSTM.SocketEntry>
-
writeData
protected TcpAddress writeData(java.nio.channels.SelectionKey sk, TcpAddress incomingAddress)
- Overrides:
writeDatain classAbstractTcpServerThread<TLSTM.SocketEntry>
-
readMessage
private void readMessage(java.nio.channels.SelectionKey sk, java.nio.channels.SocketChannel readChannel, TcpAddress incomingAddress, TLSTM.SocketEntry session) throws java.io.IOException- Throws:
java.io.IOException
-
dispatchMessage
private void dispatchMessage(TcpAddress incomingAddress, java.nio.ByteBuffer byteBuffer, long bytesRead, java.lang.Object sessionID, TransportStateReference tmStateReference)
-
writeMessage
private void writeMessage(TLSTM.SocketEntry entry, java.nio.channels.SocketChannel sc) throws java.io.IOException
- Throws:
java.io.IOException
-
-