Class TLSTM.ServerThread
java.lang.Object
org.snmp4j.transport.AbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
org.snmp4j.transport.TLSTM.ServerThread
- All Implemented Interfaces:
Runnable, WorkerTask
- Enclosing class:
TLSTM
protected class TLSTM.ServerThread
extends AbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
- Since:
- 2.0
- Version:
- 3.5.0
- Author:
- Frank Fock
-
Field Summary
Fields inherited from class AbstractTransportServerThread
exitLatch, lastError, pending, selector, serverAddress, shutdown, ssc, stop, transportMapping -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TcpAddresscreateSocketEntry(TcpAddress address, SocketChannel socketChannel, boolean useClientMode, TransportStateReference tmStateReference) protected voidbooleanjoin(long timeout) Waits until this task has been finished or the specified timeout has elapsed.protected SocketChannelopenSocketChannel(ProtocolFamily family) protected voidprotected booleanreadMessage(SelectionKey sk, SocketChannel readChannel, TcpAddress incomingAddress, TLSTM.SocketEntry session) removeSocketEntry(TcpAddress incomingAddress) voidrun()booleanrunDelegatedTasks(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(TcpAddress address, byte[] message, TransportStateReference tmStateReference) voidshutdown()Gracefully shuts down this task.protected voidwriteMessage(TLSTM.SocketEntry entry, SocketChannel sc) Methods inherited from class AbstractTransportServerThread
close, closeChannel, connectChannel, connectSocketToSendMessage, doServer, getSelector, interrupt, join, sendMessage, terminate, writeData
-
Constructor Details
-
ServerThread
- Throws:
IOExceptionNoSuchAlgorithmException
-
-
Method Details
-
processQueues
protected void processQueues()- Specified by:
processQueuesin classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
-
createIncomingAddress
- Specified by:
createIncomingAddressin classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
-
runDelegatedTasks
public boolean runDelegatedTasks(SSLEngineResult result, TLSTM.SocketEntry entry) throws 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:
trueif processing of delegated tasks has been finished,falseotherwise.- Throws:
IOException
-
getLastError
-
sendMessage
public void sendMessage(TcpAddress address, byte[] message, TransportStateReference tmStateReference) throws IOException - Throws:
IOException
-
createSocketEntry
public TLSTM.SocketEntry createSocketEntry(TcpAddress address, SocketChannel socketChannel, boolean useClientMode, TransportStateReference tmStateReference) - Specified by:
createSocketEntryin classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
-
openSocketChannel
- Specified by:
openSocketChannelin classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>- Throws:
IOException
-
run
public void run()- Specified by:
runin interfaceRunnable- Specified by:
runin classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
-
removeSocketEntry
- Specified by:
removeSocketEntryin classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
-
readMessage
protected boolean readMessage(SelectionKey sk, SocketChannel readChannel, TcpAddress incomingAddress, TLSTM.SocketEntry session) throws IOException - Specified by:
readMessagein classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>- Throws:
IOException
-
fireIncrementCounterSessionClose
protected void fireIncrementCounterSessionClose()- Overrides:
fireIncrementCounterSessionClosein classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>
-
writeMessage
- Overrides:
writeMessagein classAbstractTransportServerThread<TcpAddress, TLSTM.SocketEntry>- Throws:
IOException
-
shutdown
public void shutdown()Description copied from interface:WorkerTaskGracefully shuts down this task. All pending operations should be finished, but no new operations should be accepted. -
join
Description copied from interface:WorkerTaskWaits until this task has been finished or the specified timeout has elapsed.- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the task has been finished,falseotherwise.- Throws:
InterruptedException- if the join has been interrupted by another thread.
-