java.lang.Object
org.snmp4j.transport.AbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
org.snmp4j.transport.DefaultTcpTransportMapping.ServerThread
- All Implemented Interfaces:
Runnable
,WorkerTask
- Enclosing class:
- DefaultTcpTransportMapping
protected class DefaultTcpTransportMapping.ServerThread
extends AbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
Field Summary
FieldsFields inherited from class org.snmp4j.transport.AbstractTransportServerThread
pending, selector, serverAddress, transportMapping
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected TcpAddress
protected DefaultTcpTransportMapping.SocketEntry
createSocketEntry(TcpAddress address, Socket socket, boolean useClientMode, TransportStateReference tmStateReference)
void
Interrupts this task.void
join()
Waits until this task has been finished.protected SocketChannel
openSocketChannel(ProtocolFamily family)
protected void
protected boolean
readMessage(SelectionKey sk, SocketChannel readChannel, TcpAddress incomingAddress, DefaultTcpTransportMapping.SocketEntry socketEntry)
protected void
readSnmpMessagePayload(SocketChannel readChannel, TcpAddress incomingAddress, DefaultTcpTransportMapping.SocketEntry entry, ByteBuffer byteBuffer)
removeSocketEntry(TcpAddress incomingAddress)
void
run()
void
TheWorkerPool
might call this method to hint the activeWorkTask
instance to complete execution as soon as possible.Methods inherited from class org.snmp4j.transport.AbstractTransportServerThread
closeChannel, connectChannel, connectSocketToSendMessage, doServer, fireIncrementCounterSessionClose, sendMessage, writeData, writeMessage
-
Field Details
-
buf
protected byte[] buf
-
-
Constructor Details
-
ServerThread
- Throws:
IOException
-
-
Method Details
-
getLastError
-
createSocketEntry
protected DefaultTcpTransportMapping.SocketEntry createSocketEntry(TcpAddress address, Socket socket, boolean useClientMode, TransportStateReference tmStateReference)- Specified by:
createSocketEntry
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
openSocketChannel
- Specified by:
openSocketChannel
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
- Throws:
IOException
-
run
public void run()- Specified by:
run
in interfaceRunnable
- Specified by:
run
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
readMessage
protected boolean readMessage(SelectionKey sk, SocketChannel readChannel, TcpAddress incomingAddress, DefaultTcpTransportMapping.SocketEntry socketEntry) throws IOException- Specified by:
readMessage
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
- Throws:
IOException
-
processQueues
protected void processQueues()- Specified by:
processQueues
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
removeSocketEntry
- Specified by:
removeSocketEntry
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
createIncomingAddress
- Specified by:
createIncomingAddress
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
readSnmpMessagePayload
protected void readSnmpMessagePayload(SocketChannel readChannel, TcpAddress incomingAddress, DefaultTcpTransportMapping.SocketEntry entry, ByteBuffer byteBuffer) throws IOException- Throws:
IOException
-
close
public void close()- Overrides:
close
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
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
- Overrides:
terminate
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
join
public void join()Description copied from interface:WorkerTask
Waits until this task has been finished.- Specified by:
join
in interfaceWorkerTask
- Overrides:
join
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
-
interrupt
public void interrupt()Description copied from interface:WorkerTask
Interrupts this task.- Specified by:
interrupt
in interfaceWorkerTask
- Overrides:
interrupt
in classAbstractTransportServerThread<TcpAddress,DefaultTcpTransportMapping.SocketEntry>
- See Also:
Thread.interrupt()
-