public abstract class ReceiverBase extends Object implements ChannelReceiver, ListenCallback, RxTaskPool.TaskCreator
Modifier and Type | Field and Description |
---|---|
static int |
OPTION_DIRECT_BUFFER |
MAX_UDP_SIZE
Constructor and Description |
---|
ReceiverBase() |
Modifier and Type | Method and Description |
---|---|
protected void |
bind(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(DatagramSocket socket,
int portstart,
int retries)
Same as bind() except it does it for the UDP port
|
boolean |
doListen() |
String |
getAddress() |
int |
getAutoBind() |
InetAddress |
getBind() |
Channel |
getChannel() |
boolean |
getDirect() |
ExecutorService |
getExecutor() |
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() |
String |
getTcpListenAddress()
Deprecated.
use getAddress
|
int |
getTcpListenPort()
Deprecated.
use getPort
|
boolean |
getTcpNoDelay() |
long |
getTcpSelectorTimeout()
Deprecated.
use getSelectorTimeout
|
int |
getTcpThreadCount()
Deprecated.
use getMinThreads()/getMaxThreads()
|
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(String host) |
void |
setAutoBind(int autoBind) |
void |
setBind(InetAddress bind) |
void |
setChannel(Channel channel) |
void |
setDaemon(boolean daemon) |
void |
setDirect(boolean direct) |
void |
setExecutor(ExecutorService executor) |
void |
setHost(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 |
setTcpListenAddress(String tcpListenHost)
Deprecated.
use setAddress
|
void |
setTcpListenPort(int tcpListenPort)
Deprecated.
use setPort
|
void |
setTcpNoDelay(boolean tcpNoDelay) |
void |
setTcpSelectorTimeout(long selTimeout)
Deprecated.
use setSelectorTimeout
|
void |
setTcpThreadCount(int tcpThreadCount)
Deprecated.
use setMaxThreads/setMinThreads
|
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
public void start() throws IOException
ChannelReceiver
start
in interface ChannelReceiver
IOException
- Listen failedpublic 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()
@Deprecated public int getTcpThreadCount()
public void setMessageListener(MessageListener listener)
setMessageListener
in interface ChannelReceiver
listener
- MessageListenerMessageListener
@Deprecated public void setTcpListenPort(int tcpListenPort)
tcpListenPort
- int@Deprecated public void setTcpListenAddress(String tcpListenHost)
tcpListenHost
- Stringpublic void setRxBufSize(int rxBufSize)
public void setTxBufSize(int txBufSize)
@Deprecated public void setTcpThreadCount(int tcpThreadCount)
tcpThreadCount
- intpublic InetAddress getBind()
protected void bind(ServerSocket socket, int portstart, int retries) throws IOException
getBind()
.socket
- The socket to bindportstart
- Starting port for bind attemptsretries
- Number of times to attempt to bind (port incremented
between attempts)IOException
- Socket bind errorprotected int bindUdp(DatagramSocket socket, int portstart, int retries) throws IOException
socket
- The socket to bindportstart
- Starting port for bind attemptsretries
- Number of times to attempt to bind (port incremented
between attempts)IOException
- Socket bind errorpublic void messageDataReceived(ChannelMessage data)
ListenCallback
messageDataReceived
in interface ListenCallback
data
- - the message bytes received from the cluster/replication systempublic int getWorkerThreadOptions()
public void setBind(InetAddress bind)
bind
- The bind to set.@Deprecated public int getTcpListenPort()
public boolean getDirect()
public void setDirect(boolean direct)
public String getAddress()
public String getHost()
ChannelReceiver
getHost
in interface ChannelReceiver
public long getSelectorTimeout()
@Deprecated public long getTcpSelectorTimeout()
public boolean doListen()
public MessageListener getListener()
public RxTaskPool getTaskPool()
@Deprecated public String getTcpListenAddress()
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 ExecutorService getExecutor()
public boolean isListening()
@Deprecated public void setTcpSelectorTimeout(long selTimeout)
selTimeout
- longpublic void setSelectorTimeout(long selTimeout)
public void setListen(boolean doListen)
public void setAddress(String host)
public void setHost(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(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-2021 Apache Software Foundation. All Rights Reserved.