class DefaultTcpTransportMapping.ServerThread extends java.lang.Object implements WorkerTask
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
buf |
private java.lang.Throwable |
lastError |
private java.util.LinkedList<DefaultTcpTransportMapping.SocketEntry> |
pending |
private java.nio.channels.Selector |
selector |
private java.nio.channels.ServerSocketChannel |
ssc |
private boolean |
stop |
| Constructor and Description |
|---|
ServerThread() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
private void |
closeChannel(java.nio.channels.SelectableChannel channel) |
private void |
connectChannel(java.nio.channels.SelectionKey sk,
TcpAddress incomingAddress) |
private void |
dispatchMessage(TcpAddress incomingAddress,
java.nio.ByteBuffer byteBuffer,
long bytesRead,
java.lang.Object sessionID) |
java.lang.Throwable |
getLastError() |
void |
interrupt()
Interrupts this task.
|
void |
join()
Waits until this task has been finished.
|
private void |
processPending() |
private void |
readMessage(java.nio.channels.SelectionKey sk,
java.nio.channels.SocketChannel readChannel,
TcpAddress incomingAddress) |
void |
run() |
void |
sendMessage(Address address,
byte[] message,
TransportStateReference tmStateReference) |
void |
terminate()
The
WorkerPool might call this method to hint the active
WorkTask instance to complete execution as soon as possible. |
private TcpAddress |
writeData(java.nio.channels.SelectionKey sk,
TcpAddress incomingAddress) |
private void |
writeMessage(DefaultTcpTransportMapping.SocketEntry entry,
java.nio.channels.SocketChannel sc) |
private byte[] buf
private volatile boolean stop
private java.lang.Throwable lastError
private java.nio.channels.ServerSocketChannel ssc
private java.nio.channels.Selector selector
private java.util.LinkedList<DefaultTcpTransportMapping.SocketEntry> pending
public ServerThread()
throws java.io.IOException
java.io.IOExceptionprivate void processPending()
public java.lang.Throwable getLastError()
public void sendMessage(Address address, byte[] message, TransportStateReference tmStateReference) throws java.io.IOException
java.io.IOExceptionpublic void run()
run in interface java.lang.Runnableprivate void connectChannel(java.nio.channels.SelectionKey sk,
TcpAddress incomingAddress)
private TcpAddress writeData(java.nio.channels.SelectionKey sk, TcpAddress incomingAddress)
private void closeChannel(java.nio.channels.SelectableChannel channel)
private void readMessage(java.nio.channels.SelectionKey sk,
java.nio.channels.SocketChannel readChannel,
TcpAddress incomingAddress)
throws java.io.IOException
java.io.IOExceptionprivate void dispatchMessage(TcpAddress incomingAddress, java.nio.ByteBuffer byteBuffer, long bytesRead, java.lang.Object sessionID)
private void writeMessage(DefaultTcpTransportMapping.SocketEntry entry, java.nio.channels.SocketChannel sc) throws java.io.IOException
java.io.IOExceptionpublic void close()
public void terminate()
WorkerTaskWorkerPool might call this method to hint the active
WorkTask instance to complete execution as soon as possible.terminate in interface WorkerTaskpublic void join()
WorkerTaskjoin in interface WorkerTaskpublic void interrupt()
WorkerTaskinterrupt in interface WorkerTaskThread.interrupt()