public abstract class ReceiverBase extends java.lang.Object implements ChannelReceiver, ListenCallback, RxTaskPool.TaskCreator
Modifier and Type | Field and Description |
---|---|
static int |
OPTION_DIRECT_BUFFER |
protected static StringManager |
sm |
MAX_UDP_SIZE
Constructor and Description |
---|
ReceiverBase() |
Modifier and Type | Method and Description |
---|---|
protected void |
bind(java.net.ServerSocket socket,
int portstart,
int retries)
Attempts to bind using the provided port and if that fails attempts to
bind to each of the ports from portstart to (portstart + retries -1)
until either there are no more ports or the bind is successful.
|
protected int |
bindUdp(java.net.DatagramSocket socket,
int portstart,
int retries)
Same as bind() except it does it for the UDP port
|
boolean |
doListen() |
java.lang.String |
getAddress() |
int |
getAutoBind() |
java.net.InetAddress |
getBind() |
Channel |
getChannel() |
boolean |
getDirect() |
java.util.concurrent.ExecutorService |
getExecutor() |
java.lang.String |
getHost()
String representation of the IPv4 or IPv6 address that this host is listening
to.
|
MessageListener |
getListener() |
long |
getMaxIdleTime() |
int |
getMaxTasks() |
int |
getMaxThreads() |
MessageListener |
getMessageListener()
getMessageListener
|
int |
getMinTasks() |
int |
getMinThreads() |
boolean |
getOoBInline() |
int |
getPort()
Returns the listening port
|
int |
getRxBufSize() |
int |
getSecurePort()
Returns the secure listening port
|
long |
getSelectorTimeout() |
boolean |
getSoKeepAlive() |
boolean |
getSoLingerOn() |
int |
getSoLingerTime() |
boolean |
getSoReuseAddress() |
int |
getSoTrafficClass() |
RxTaskPool |
getTaskPool() |
boolean |
getTcpNoDelay() |
int |
getTimeout() |
int |
getTxBufSize() |
int |
getUdpPort()
Returns the UDP port
|
int |
getUdpRxBufSize() |
int |
getUdpTxBufSize() |
boolean |
getUseBufferPool() |
int |
getWorkerThreadOptions() |
void |
heartbeat()
Heartbeat invocation for resources cleanup etc
|
boolean |
isDaemon() |
boolean |
isListening() |
void |
messageDataReceived(ChannelMessage data)
This method is invoked on the callback object to notify it that new data has
been received from one of the cluster nodes.
|
void |
setAddress(java.lang.String host) |
void |
setAutoBind(int autoBind) |
void |
setBind(java.net.InetAddress bind) |
void |
setChannel(Channel channel) |
void |
setDaemon(boolean daemon) |
void |
setDirect(boolean direct) |
void |
setExecutor(java.util.concurrent.ExecutorService executor) |
void |
setHost(java.lang.String host) |
void |
setListen(boolean doListen) |
void |
setListener(MessageListener listener) |
void |
setMaxIdleTime(long maxIdleTime) |
void |
setMaxTasks(int maxTasks) |
void |
setMaxThreads(int maxThreads) |
void |
setMessageListener(MessageListener listener)
setMessageListener
|
void |
setMinTasks(int minTasks) |
void |
setMinThreads(int minThreads) |
void |
setOoBInline(boolean ooBInline) |
void |
setPool(RxTaskPool pool) |
void |
setPort(int port) |
void |
setRxBufSize(int rxBufSize) |
void |
setSecurePort(int securePort) |
void |
setSelectorTimeout(long selTimeout) |
void |
setSoKeepAlive(boolean soKeepAlive) |
void |
setSoLingerOn(boolean soLingerOn) |
void |
setSoLingerTime(int soLingerTime) |
void |
setSoReuseAddress(boolean soReuseAddress) |
void |
setSoTrafficClass(int soTrafficClass) |
void |
setTcpNoDelay(boolean tcpNoDelay) |
void |
setTimeout(int timeout) |
void |
setTxBufSize(int txBufSize) |
void |
setUdpPort(int udpPort) |
void |
setUdpRxBufSize(int udpRxBufSize) |
void |
setUdpTxBufSize(int udpTxBufSize) |
void |
setUseBufferPool(boolean useBufferPool) |
void |
start()
Start listening for incoming messages on the host/port
|
void |
stop()
Stop listening for messages
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createRxTask
public static final int OPTION_DIRECT_BUFFER
protected static final StringManager sm
public void start() throws java.io.IOException
ChannelReceiver
start
in interface ChannelReceiver
java.io.IOException
public void stop()
ChannelReceiver
stop
in interface ChannelReceiver
public MessageListener getMessageListener()
getMessageListener
in interface ChannelReceiver
MessageListener
public int getPort()
ChannelReceiver
getPort
in interface ChannelReceiver
public int getRxBufSize()
public int getTxBufSize()
public void setMessageListener(MessageListener listener)
setMessageListener
in interface ChannelReceiver
listener
- MessageListenerMessageListener
public void setRxBufSize(int rxBufSize)
public void setTxBufSize(int txBufSize)
public java.net.InetAddress getBind()
protected void bind(java.net.ServerSocket socket, int portstart, int retries) throws java.io.IOException
getBind()
.socket
- The socket to bindportstart
- Starting port for bind attemptsretries
- Number of times to attempt to bind (port incremented
between attempts)java.io.IOException
protected int bindUdp(java.net.DatagramSocket socket, int portstart, int retries) throws java.io.IOException
socket
- portstart
- retries
- java.io.IOException
public void messageDataReceived(ChannelMessage data)
ListenCallback
messageDataReceived
in interface ListenCallback
data
- - the message bytes received from the cluster/replication systempublic int getWorkerThreadOptions()
public void setBind(java.net.InetAddress bind)
bind
- The bind to set.public boolean getDirect()
public void setDirect(boolean direct)
public java.lang.String getAddress()
public java.lang.String getHost()
ChannelReceiver
getHost
in interface ChannelReceiver
public long getSelectorTimeout()
public boolean doListen()
public MessageListener getListener()
public RxTaskPool getTaskPool()
public int getAutoBind()
public int getMaxThreads()
public int getMinThreads()
public boolean getTcpNoDelay()
public boolean getSoKeepAlive()
public boolean getOoBInline()
public boolean getSoLingerOn()
public int getSoLingerTime()
public boolean getSoReuseAddress()
public int getSoTrafficClass()
public int getTimeout()
public boolean getUseBufferPool()
public int getSecurePort()
ChannelReceiver
getSecurePort
in interface ChannelReceiver
public int getMinTasks()
public int getMaxTasks()
public java.util.concurrent.ExecutorService getExecutor()
public boolean isListening()
public void setSelectorTimeout(long selTimeout)
public void setListen(boolean doListen)
public void setAddress(java.lang.String host)
public void setHost(java.lang.String host)
public void setListener(MessageListener listener)
public void setPool(RxTaskPool pool)
public void setPort(int port)
public void setAutoBind(int autoBind)
public void setMaxThreads(int maxThreads)
public void setMinThreads(int minThreads)
public void setTcpNoDelay(boolean tcpNoDelay)
public void setSoKeepAlive(boolean soKeepAlive)
public void setOoBInline(boolean ooBInline)
public void setSoLingerOn(boolean soLingerOn)
public void setSoLingerTime(int soLingerTime)
public void setSoReuseAddress(boolean soReuseAddress)
public void setSoTrafficClass(int soTrafficClass)
public void setTimeout(int timeout)
public void setUseBufferPool(boolean useBufferPool)
public void setSecurePort(int securePort)
public void setMinTasks(int minTasks)
public void setMaxTasks(int maxTasks)
public void setExecutor(java.util.concurrent.ExecutorService executor)
public void heartbeat()
Heartbeat
public int getUdpPort()
ChannelReceiver
getUdpPort
in interface ChannelReceiver
public void setUdpPort(int udpPort)
public int getUdpRxBufSize()
public void setUdpRxBufSize(int udpRxBufSize)
public int getUdpTxBufSize()
public void setUdpTxBufSize(int udpTxBufSize)
public Channel getChannel()
public void setChannel(Channel channel)
public boolean isDaemon()
public long getMaxIdleTime()
public void setDaemon(boolean daemon)
public void setMaxIdleTime(long maxIdleTime)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.