Module org.snmp4j
Package org.snmp4j.transport
Class AbstractTcpServerThread<S extends AbstractSocketEntry>
java.lang.Object
org.snmp4j.transport.AbstractTcpServerThread<S>
- All Implemented Interfaces:
Runnable,WorkerTask
- Direct Known Subclasses:
DefaultTcpTransportMapping.ServerThread,TLSTM.ServerThread
public abstract class AbstractTcpServerThread<S extends AbstractSocketEntry>
extends Object
implements WorkerTask
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final LogAdapterprotected final LinkedList<S> protected Selectorprotected booleanprotected TcpTransportMapping<?> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidcloseChannel(SelectableChannel channel) protected voidconnectChannel(SelectionKey sk, TcpAddress incomingAddress) protected voidconnectSocketToSendMessage(Address address, byte[] message, Socket s, S entry, Map<Address, S> sockets) voidInterrupts this task.voidjoin()Waits until this task has been finished.private voidqueueNewMessage(S entry) abstract SremoveSocketEntry(TcpAddress incomingAddress) abstract voidrun()voidTheWorkerPoolmight call this method to hint the activeWorkTaskinstance to complete execution as soon as possible.protected TcpAddresswriteData(SelectionKey sk, TcpAddress incomingAddress) private voidwriteMessage(S entry, SocketChannel sc)
-
Field Details
-
logger
-
tcpTransportMapping
-
stop
protected volatile boolean stop -
selector
-
pending
-
-
Constructor Details
-
AbstractTcpServerThread
- Throws:
IOException
-
-
Method Details
-
connectSocketToSendMessage
-
queueNewMessage
-
run
public abstract void run() -
removeSocketEntry
-
connectChannel
-
writeData
-
closeChannel
-
writeMessage
- Throws:
IOException
-
close
public void close() -
terminate
public void terminate()Description copied from interface:WorkerTaskTheWorkerPoolmight call this method to hint the activeWorkTaskinstance to complete execution as soon as possible.- Specified by:
terminatein interfaceWorkerTask
-
join
public void join()Description copied from interface:WorkerTaskWaits until this task has been finished.- Specified by:
joinin interfaceWorkerTask
-
interrupt
public void interrupt()Description copied from interface:WorkerTaskInterrupts this task.- Specified by:
interruptin interfaceWorkerTask- See Also:
-