Module org.snmp4j
Package org.snmp4j.transport
Class AbstractTransportServerThread<A extends Address,S extends AbstractSocketEntry<A>>
java.lang.Object
org.snmp4j.transport.AbstractTransportServerThread<A,S>
- All Implemented Interfaces:
Runnable
,WorkerTask
- Direct Known Subclasses:
DefaultTcpTransportMapping.ServerThread
public abstract class AbstractTransportServerThread<A extends Address,S extends AbstractSocketEntry<A>>
extends Object
implements WorkerTask
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LinkedList<S>
protected Selector
protected boolean
protected AbstractConnectionOrientedTransportMapping<A,S>
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractTransportServerThread(AbstractConnectionOrientedTransportMapping<A,S> transportMapping)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected void
closeChannel(SelectableChannel channel)
protected void
connectChannel(SelectionKey sk, A incomingAddress)
protected void
protected abstract A
createIncomingAddress(Socket socket)
void
Interrupts this task.void
join()
Waits until this task has been finished.abstract S
removeSocketEntry(A incomingAddress)
abstract void
run()
void
TheWorkerPool
might call this method to hint the activeWorkTask
instance to complete execution as soon as possible.protected A
writeData(SelectionKey sk, A incomingAddress)
protected void
writeMessage(S entry, SocketChannel sc)
-
Field Details
-
transportMapping
protected AbstractConnectionOrientedTransportMapping<A extends Address,S extends AbstractSocketEntry<A>> transportMapping -
stop
protected volatile boolean stop -
selector
-
pending
-
-
Constructor Details
-
AbstractTransportServerThread
public AbstractTransportServerThread(AbstractConnectionOrientedTransportMapping<A,S> transportMapping) throws IOException- Throws:
IOException
-
-
Method Details
-
connectSocketToSendMessage
-
run
public abstract void run() -
removeSocketEntry
-
connectChannel
-
writeData
-
createIncomingAddress
-
closeChannel
-
writeMessage
- Throws:
IOException
-
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()
-