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
public abstract class AbstractTcpServerThread<S extends AbstractSocketEntry>
extends Object
implements WorkerTask
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LinkedList<S>
protected Selector
protected boolean
protected TcpTransportMapping<?>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
closeChannel(SelectableChannel channel)
protected void
connectChannel(SelectionKey sk, TcpAddress incomingAddress)
protected void
connectSocketToSendMessage(Address address, byte[] message, Socket s, S entry, Map<Address,S> sockets)
void
Interrupts this task.void
join()
Waits until this task has been finished.abstract S
removeSocketEntry(TcpAddress incomingAddress)
abstract void
run()
void
TheWorkerPool
might call this method to hint the activeWorkTask
instance to complete execution as soon as possible.protected TcpAddress
writeData(SelectionKey sk, TcpAddress incomingAddress)
-
Field Details
-
tcpTransportMapping
-
stop
protected volatile boolean stop -
selector
-
pending
-
-
Constructor Details
-
AbstractTcpServerThread
- Throws:
IOException
-
-
Method Details
-
connectSocketToSendMessage
-
run
public abstract void run() -
removeSocketEntry
-
connectChannel
-
writeData
-
closeChannel
-
close
public void close() -
terminate
public void terminate()Description copied from interface:WorkerTask
TheWorkerPool
might call this method to hint the activeWorkTask
instance to complete execution as soon as possible.- Specified by:
terminate
in interfaceWorkerTask
-
join
public void join()Description copied from interface:WorkerTask
Waits until this task has been finished.- Specified by:
join
in interfaceWorkerTask
-
interrupt
public void interrupt()Description copied from interface:WorkerTask
Interrupts this task.- Specified by:
interrupt
in interfaceWorkerTask
- See Also:
Thread.interrupt()
-