- 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>
inQueue
private java.lang.Throwable
lastError
private java.util.concurrent.BlockingQueue<TLSTM.SocketEntry>
outQueue
private java.nio.channels.ServerSocketChannel
ssc
-
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 void
closeChannelAndRemoveSocket(TLSTM.SocketEntry entry, java.io.IOException ioException)
private void
dispatchMessage(TcpAddress incomingAddress, java.nio.ByteBuffer byteBuffer, long bytesRead, java.lang.Object sessionID, TransportStateReference tmStateReference)
java.lang.Throwable
getLastError()
private boolean
isConnectionClosed(TLSTM.SocketEntry entry, java.io.IOException ioException)
private void
processPending()
private void
processQueues()
private void
readMessage(java.nio.channels.SelectionKey sk, java.nio.channels.SocketChannel readChannel, TcpAddress incomingAddress, TLSTM.SocketEntry session)
TLSTM.SocketEntry
removeSocketEntry(TcpAddress incomingAddress)
void
run()
boolean
runDelegatedTasks(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.void
sendMessage(Address address, byte[] message, TransportStateReference tmStateReference)
protected TcpAddress
writeData(java.nio.channels.SelectionKey sk, TcpAddress incomingAddress)
private void
writeMessage(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.IOException
If 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:
true
if processing of delegated tasks has been finished,false
otherwise.- 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:
run
in interfacejava.lang.Runnable
- Specified by:
run
in classAbstractTcpServerThread<TLSTM.SocketEntry>
-
removeSocketEntry
public TLSTM.SocketEntry removeSocketEntry(TcpAddress incomingAddress)
- Specified by:
removeSocketEntry
in classAbstractTcpServerThread<TLSTM.SocketEntry>
-
writeData
protected TcpAddress writeData(java.nio.channels.SelectionKey sk, TcpAddress incomingAddress)
- Overrides:
writeData
in 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
-
-