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() |
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() |
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(String host) |
void |
setAutoBind(int autoBind) |
void |
setBind(InetAddress bind) |
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 |
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
public void start() throws IOException
ChannelReceiver
start
in interface ChannelReceiver
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
- MessageListener
TODO Implement this org.apache.catalina.tribes.ChannelReceiver methodMessageListener
public void setRxBufSize(int rxBufSize)
public void setTxBufSize(int txBufSize)
public 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
protected int bindUdp(DatagramSocket socket, int portstart, int retries) throws IOException
socket
- portstart
- retries
- 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(InetAddress bind)
bind
- The bind to set.public boolean getDirect()
public void setDirect(boolean direct)
public String getAddress()
public 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 ExecutorService getExecutor()
public boolean isListening()
public 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 boolean isDaemon()
public long getMaxIdleTime()
public void setDaemon(boolean daemon)
public void setMaxIdleTime(long maxIdleTime)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.