public class NioReceiver extends ReceiverBase implements Runnable, NioReceiverMBean
| Modifier and Type | Field and Description |
|---|---|
protected Deque<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(Runnable event) |
protected void |
bind() |
static void |
cancelledKey(SelectionKey key) |
AbstractRxTask |
createRxTask() |
void |
events() |
protected void |
listen()
Get data from channel and store in byte array
send it to cluster
|
protected void |
readDataFromSocket(SelectionKey key)
Sample data handler method for a channel with data ready to read.
|
protected void |
registerChannel(Selector selector,
SelectableChannel channel,
int ops,
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, getActiveCount, getAddress, getAutoBind, getBind, getChannel, getCompletedTaskCount, getDirect, getExecutor, getHost, getListener, getMaxIdleTime, getMaxTasks, getMaxThreads, getMessageListener, getMinTasks, getMinThreads, getOoBInline, getPoolSize, getPort, getRxBufSize, getSecurePort, getSelectorTimeout, getSoKeepAlive, getSoLingerOn, getSoLingerTime, getSoReuseAddress, getSoTrafficClass, getTaskCount, getTaskPool, getTcpNoDelay, 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, setTcpNoDelay, setTimeout, setTxBufSize, setUdpPort, setUdpRxBufSize, setUdpTxBufSize, setUseBufferPoolclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetActiveCount, getAddress, getAutoBind, getCompletedTaskCount, getDirect, getMaxIdleTime, getMaxThreads, getMinThreads, getOoBInline, getPoolSize, getPort, getRxBufSize, getSecurePort, getSelectorTimeout, getSoKeepAlive, getSoLingerOn, getSoLingerTime, getSoReuseAddress, getTaskCount, getTcpNoDelay, getTimeout, getTxBufSize, getUdpPort, getUdpRxBufSize, getUdpTxBufSize, getUseBufferPool, isListeningprotected static final StringManager sm
protected long lastCheck
public void stop()
ChannelReceiverstop in interface ChannelReceiverstop in class ReceiverBasepublic void start()
throws IOException
start in interface ChannelReceiverstart in class ReceiverBaseIOException - If the receiver fails to startChannelReceiver.start()public AbstractRxTask createRxTask()
createRxTask in interface RxTaskPool.TaskCreatorprotected void bind()
throws IOException
IOExceptionpublic void addEvent(Runnable event)
public void events()
public static void cancelledKey(SelectionKey key)
protected void socketTimeouts()
protected void listen()
throws Exception
IOException - IO errorExceptionprotected void stopListening()
ReceiverBase.stop()protected void registerChannel(Selector selector, SelectableChannel channel, int ops, Object attach) throws Exception
selector - The selector to usechannel - The channelops - The operations to registerattach - Attachment objectException - IO error with channelprotected void readDataFromSocket(SelectionKey key) throws 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.Exception - IO error with channelCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.