public class NioReceiver extends ReceiverBase implements java.lang.Runnable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.LinkedList<java.lang.Runnable> |
events |
protected long |
lastCheck |
protected static StringManager |
sm
The string manager for this package.
|
OPTION_DIRECT_BUFFERMAX_UDP_SIZE| Constructor and Description |
|---|
NioReceiver() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEvent(java.lang.Runnable event) |
protected void |
bind() |
static void |
cancelledKey(java.nio.channels.SelectionKey key) |
AbstractRxTask |
createRxTask() |
void |
events() |
java.lang.String |
getInfo()
Return descriptive information about this implementation and the
corresponding version number, in the format
<description>/<version>. |
protected void |
listen()
get data from channel and store in byte array
send it to cluster
|
protected void |
readDataFromSocket(java.nio.channels.SelectionKey key)
Sample data handler method for a channel with data ready to read.
|
protected void |
registerChannel(java.nio.channels.Selector selector,
java.nio.channels.SelectableChannel channel,
int ops,
java.lang.Object attach)
Register the given channel with the given selector for
the given operations of interest
|
void |
run()
Start thread and listen
|
protected void |
socketTimeouts() |
void |
start()
start cluster receiver
|
void |
stop()
Stop listening for messages
|
protected void |
stopListening()
Close Selector.
|
bind, bindUdp, doListen, getAddress, getAutoBind, getBind, getChannel, getDirect, getExecutor, getHost, getListener, getMaxIdleTime, getMaxTasks, getMaxThreads, getMessageListener, getMinTasks, getMinThreads, getOoBInline, getPort, getRxBufSize, getSecurePort, getSelectorTimeout, getSoKeepAlive, getSoLingerOn, getSoLingerTime, getSoReuseAddress, getSoTrafficClass, getTaskPool, getTcpListenAddress, getTcpListenPort, getTcpNoDelay, getTcpSelectorTimeout, getTcpThreadCount, getTimeout, getTxBufSize, getUdpPort, getUdpRxBufSize, getUdpTxBufSize, getUseBufferPool, getWorkerThreadOptions, heartbeat, isDaemon, isListening, messageDataReceived, setAddress, setAutoBind, setBind, setChannel, setDaemon, setDirect, setExecutor, setHost, setListen, setListener, setMaxIdleTime, setMaxTasks, setMaxThreads, setMessageListener, setMinTasks, setMinThreads, setOoBInline, setPool, setPort, setRxBufSize, setSecurePort, setSelectorTimeout, setSoKeepAlive, setSoLingerOn, setSoLingerTime, setSoReuseAddress, setSoTrafficClass, setTcpListenAddress, setTcpListenPort, setTcpNoDelay, setTcpSelectorTimeout, setTcpThreadCount, setTimeout, setTxBufSize, setUdpPort, setUdpRxBufSize, setUdpTxBufSize, setUseBufferPoolprotected static final StringManager sm
protected java.util.LinkedList<java.lang.Runnable> events
protected long lastCheck
public java.lang.String getInfo()
<description>/<version>.public void stop()
ChannelReceiverstop in interface ChannelReceiverstop in class ReceiverBasepublic void start()
throws java.io.IOException
start in interface ChannelReceiverstart in class ReceiverBasejava.io.IOExceptionChannelReceiver.start()public AbstractRxTask createRxTask()
createRxTask in interface RxTaskPool.TaskCreatorprotected void bind()
throws java.io.IOException
java.io.IOExceptionpublic void addEvent(java.lang.Runnable event)
public void events()
public static void cancelledKey(java.nio.channels.SelectionKey key)
protected void socketTimeouts()
protected void listen()
throws java.lang.Exception
java.io.IOExceptionjava.nio.channels.ClosedChannelExceptionjava.lang.Exceptionprotected void stopListening()
ReceiverBase.stop()protected void registerChannel(java.nio.channels.Selector selector,
java.nio.channels.SelectableChannel channel,
int ops,
java.lang.Object attach)
throws java.lang.Exception
java.lang.Exceptionpublic void run()
run in interface java.lang.Runnableprotected void readDataFromSocket(java.nio.channels.SelectionKey key)
throws java.lang.Exception
key - A SelectionKey object associated with a channel
determined by the selector to be ready for reading. If the
channel returns an EOF condition, it is closed here, which
automatically invalidates the associated key. The selector
will then de-register the channel on the next select call.java.lang.ExceptionCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.