Class ReceiverBase
- java.lang.Object
- 
- org.apache.catalina.tribes.transport.ReceiverBase
 
- 
- All Implemented Interfaces:
- ChannelReceiver,- Heartbeat,- ListenCallback,- RxTaskPool.TaskCreator
 - Direct Known Subclasses:
- BioReceiver,- NioReceiver
 
 public abstract class ReceiverBase extends java.lang.Object implements ChannelReceiver, ListenCallback, RxTaskPool.TaskCreator 
- 
- 
Field SummaryFields Modifier and Type Field Description static intOPTION_DIRECT_BUFFERprotected static StringManagersm- 
Fields inherited from interface org.apache.catalina.tribes.ChannelReceiverMAX_UDP_SIZE
 
- 
 - 
Constructor SummaryConstructors Constructor Description ReceiverBase()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbind(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 intbindUdp(java.net.DatagramSocket socket, int portstart, int retries)Same as bind() except it does it for the UDP portbooleandoListen()intgetActiveCount()Return the current number of threads that are in use.java.lang.StringgetAddress()intgetAutoBind()java.net.InetAddressgetBind()ChannelgetChannel()Return the channel that is related to this ChannelReceiverlonggetCompletedTaskCount()Return the total number of tasks that have completed execution by the pool.booleangetDirect()java.util.concurrent.ExecutorServicegetExecutor()java.lang.StringgetHost()String representation of the IPv4 or IPv6 address that this host is listening to.MessageListenergetListener()longgetMaxIdleTime()intgetMaxTasks()intgetMaxThreads()MessageListenergetMessageListener()getMessageListenerintgetMinTasks()intgetMinThreads()booleangetOoBInline()intgetPoolSize()Return the current number of threads that are managed by the pool.intgetPort()Returns the listening portintgetRxBufSize()intgetSecurePort()Returns the secure listening portlonggetSelectorTimeout()booleangetSoKeepAlive()booleangetSoLingerOn()intgetSoLingerTime()booleangetSoReuseAddress()intgetSoTrafficClass()longgetTaskCount()Return the total number of tasks that have ever been scheduled for execution by the pool.RxTaskPoolgetTaskPool()booleangetTcpNoDelay()intgetTimeout()intgetTxBufSize()intgetUdpPort()Returns the UDP portintgetUdpRxBufSize()intgetUdpTxBufSize()booleangetUseBufferPool()intgetWorkerThreadOptions()voidheartbeat()Heartbeat invocation for resources cleanup etcbooleanisDaemon()booleanisListening()voidmessageDataReceived(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.voidsetAddress(java.lang.String host)voidsetAutoBind(int autoBind)voidsetBind(java.net.InetAddress bind)voidsetChannel(Channel channel)Set the channel that is related to this ChannelReceivervoidsetDaemon(boolean daemon)voidsetDirect(boolean direct)voidsetExecutor(java.util.concurrent.ExecutorService executor)voidsetHost(java.lang.String host)voidsetListen(boolean doListen)voidsetListener(MessageListener listener)voidsetMaxIdleTime(long maxIdleTime)voidsetMaxTasks(int maxTasks)voidsetMaxThreads(int maxThreads)voidsetMessageListener(MessageListener listener)setMessageListenervoidsetMinTasks(int minTasks)voidsetMinThreads(int minThreads)voidsetOoBInline(boolean ooBInline)voidsetPool(RxTaskPool pool)voidsetPort(int port)voidsetRxBufSize(int rxBufSize)voidsetSecurePort(int securePort)voidsetSelectorTimeout(long selTimeout)voidsetSoKeepAlive(boolean soKeepAlive)voidsetSoLingerOn(boolean soLingerOn)voidsetSoLingerTime(int soLingerTime)voidsetSoReuseAddress(boolean soReuseAddress)voidsetSoTrafficClass(int soTrafficClass)voidsetTcpNoDelay(boolean tcpNoDelay)voidsetTimeout(int timeout)voidsetTxBufSize(int txBufSize)voidsetUdpPort(int udpPort)voidsetUdpRxBufSize(int udpRxBufSize)voidsetUdpTxBufSize(int udpTxBufSize)voidsetUseBufferPool(boolean useBufferPool)voidstart()Start listening for incoming messages on the host/portvoidstop()Stop listening for messages- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.apache.catalina.tribes.transport.RxTaskPool.TaskCreatorcreateRxTask
 
- 
 
- 
- 
- 
Field Detail- 
OPTION_DIRECT_BUFFERpublic static final int OPTION_DIRECT_BUFFER - See Also:
- Constant Field Values
 
 - 
smprotected static final StringManager sm 
 
- 
 - 
Method Detail- 
startpublic void start() throws java.io.IOExceptionDescription copied from interface:ChannelReceiverStart listening for incoming messages on the host/port- Specified by:
- startin interface- ChannelReceiver
- Throws:
- java.io.IOException- Listen failed
 
 - 
stoppublic void stop() Description copied from interface:ChannelReceiverStop listening for messages- Specified by:
- stopin interface- ChannelReceiver
 
 - 
getMessageListenerpublic MessageListener getMessageListener() getMessageListener- Specified by:
- getMessageListenerin interface- ChannelReceiver
- Returns:
- MessageListener
- See Also:
- MessageListener
 
 - 
getPortpublic int getPort() Description copied from interface:ChannelReceiverReturns the listening port- Specified by:
- getPortin interface- ChannelReceiver
- Returns:
- The port
 
 - 
getRxBufSizepublic int getRxBufSize() 
 - 
getTxBufSizepublic int getTxBufSize() 
 - 
setMessageListenerpublic void setMessageListener(MessageListener listener) setMessageListener- Specified by:
- setMessageListenerin interface- ChannelReceiver
- Parameters:
- listener- MessageListener
- See Also:
- MessageListener
 
 - 
setRxBufSizepublic void setRxBufSize(int rxBufSize) 
 - 
setTxBufSizepublic void setTxBufSize(int txBufSize) 
 - 
getBindpublic java.net.InetAddress getBind() - Returns:
- Returns the bind.
 
 - 
bindprotected void bind(java.net.ServerSocket socket, int portstart, int retries) throws java.io.IOExceptionAttempts 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. The address to bind to is obtained via a call to {linkgetBind().- Parameters:
- socket- The socket to bind
- portstart- Starting port for bind attempts
- retries- Number of times to attempt to bind (port incremented between attempts)
- Throws:
- java.io.IOException- Socket bind error
 
 - 
bindUdpprotected int bindUdp(java.net.DatagramSocket socket, int portstart, int retries) throws java.io.IOExceptionSame as bind() except it does it for the UDP port- Parameters:
- socket- The socket to bind
- portstart- Starting port for bind attempts
- retries- Number of times to attempt to bind (port incremented between attempts)
- Returns:
- int The retry count
- Throws:
- java.io.IOException- Socket bind error
 
 - 
messageDataReceivedpublic void messageDataReceived(ChannelMessage data) Description copied from interface:ListenCallbackThis method is invoked on the callback object to notify it that new data has been received from one of the cluster nodes.- Specified by:
- messageDataReceivedin interface- ListenCallback
- Parameters:
- data- - the message bytes received from the cluster/replication system
 
 - 
getWorkerThreadOptionspublic int getWorkerThreadOptions() 
 - 
setBindpublic void setBind(java.net.InetAddress bind) - Parameters:
- bind- The bind to set.
 
 - 
getDirectpublic boolean getDirect() 
 - 
setDirectpublic void setDirect(boolean direct) 
 - 
getAddresspublic java.lang.String getAddress() 
 - 
getHostpublic java.lang.String getHost() Description copied from interface:ChannelReceiverString representation of the IPv4 or IPv6 address that this host is listening to.- Specified by:
- getHostin interface- ChannelReceiver
- Returns:
- the host that this receiver is listening to
 
 - 
getSelectorTimeoutpublic long getSelectorTimeout() 
 - 
doListenpublic boolean doListen() 
 - 
getListenerpublic MessageListener getListener() 
 - 
getTaskPoolpublic RxTaskPool getTaskPool() 
 - 
getAutoBindpublic int getAutoBind() 
 - 
getMaxThreadspublic int getMaxThreads() 
 - 
getMinThreadspublic int getMinThreads() 
 - 
getTcpNoDelaypublic boolean getTcpNoDelay() 
 - 
getSoKeepAlivepublic boolean getSoKeepAlive() 
 - 
getOoBInlinepublic boolean getOoBInline() 
 - 
getSoLingerOnpublic boolean getSoLingerOn() 
 - 
getSoLingerTimepublic int getSoLingerTime() 
 - 
getSoReuseAddresspublic boolean getSoReuseAddress() 
 - 
getSoTrafficClasspublic int getSoTrafficClass() 
 - 
getTimeoutpublic int getTimeout() 
 - 
getUseBufferPoolpublic boolean getUseBufferPool() 
 - 
getSecurePortpublic int getSecurePort() Description copied from interface:ChannelReceiverReturns the secure listening port- Specified by:
- getSecurePortin interface- ChannelReceiver
- Returns:
- port, -1 if a secure port is not activated
 
 - 
getMinTaskspublic int getMinTasks() 
 - 
getMaxTaskspublic int getMaxTasks() 
 - 
getExecutorpublic java.util.concurrent.ExecutorService getExecutor() 
 - 
isListeningpublic boolean isListening() 
 - 
setSelectorTimeoutpublic void setSelectorTimeout(long selTimeout) 
 - 
setListenpublic void setListen(boolean doListen) 
 - 
setAddresspublic void setAddress(java.lang.String host) 
 - 
setHostpublic void setHost(java.lang.String host) 
 - 
setListenerpublic void setListener(MessageListener listener) 
 - 
setPoolpublic void setPool(RxTaskPool pool) 
 - 
setPortpublic void setPort(int port) 
 - 
setAutoBindpublic void setAutoBind(int autoBind) 
 - 
setMaxThreadspublic void setMaxThreads(int maxThreads) 
 - 
setMinThreadspublic void setMinThreads(int minThreads) 
 - 
setTcpNoDelaypublic void setTcpNoDelay(boolean tcpNoDelay) 
 - 
setSoKeepAlivepublic void setSoKeepAlive(boolean soKeepAlive) 
 - 
setOoBInlinepublic void setOoBInline(boolean ooBInline) 
 - 
setSoLingerOnpublic void setSoLingerOn(boolean soLingerOn) 
 - 
setSoLingerTimepublic void setSoLingerTime(int soLingerTime) 
 - 
setSoReuseAddresspublic void setSoReuseAddress(boolean soReuseAddress) 
 - 
setSoTrafficClasspublic void setSoTrafficClass(int soTrafficClass) 
 - 
setTimeoutpublic void setTimeout(int timeout) 
 - 
setUseBufferPoolpublic void setUseBufferPool(boolean useBufferPool) 
 - 
setSecurePortpublic void setSecurePort(int securePort) 
 - 
setMinTaskspublic void setMinTasks(int minTasks) 
 - 
setMaxTaskspublic void setMaxTasks(int maxTasks) 
 - 
setExecutorpublic void setExecutor(java.util.concurrent.ExecutorService executor) 
 - 
heartbeatpublic void heartbeat() Description copied from interface:HeartbeatHeartbeat invocation for resources cleanup etc
 - 
getUdpPortpublic int getUdpPort() Description copied from interface:ChannelReceiverReturns the UDP port- Specified by:
- getUdpPortin interface- ChannelReceiver
- Returns:
- port, -1 if the UDP port is not activated.
 
 - 
setUdpPortpublic void setUdpPort(int udpPort) 
 - 
getUdpRxBufSizepublic int getUdpRxBufSize() 
 - 
setUdpRxBufSizepublic void setUdpRxBufSize(int udpRxBufSize) 
 - 
getUdpTxBufSizepublic int getUdpTxBufSize() 
 - 
setUdpTxBufSizepublic void setUdpTxBufSize(int udpTxBufSize) 
 - 
getChannelpublic Channel getChannel() Description copied from interface:ChannelReceiverReturn the channel that is related to this ChannelReceiver- Specified by:
- getChannelin interface- ChannelReceiver
- Returns:
- Channel
 
 - 
setChannelpublic void setChannel(Channel channel) Description copied from interface:ChannelReceiverSet the channel that is related to this ChannelReceiver- Specified by:
- setChannelin interface- ChannelReceiver
- Parameters:
- channel- The channel
 
 - 
getPoolSizepublic int getPoolSize() Return the current number of threads that are managed by the pool.- Returns:
- the current number of threads that are managed by the pool
 
 - 
getActiveCountpublic int getActiveCount() Return the current number of threads that are in use.- Returns:
- the current number of threads that are in use
 
 - 
getTaskCountpublic long getTaskCount() Return the total number of tasks that have ever been scheduled for execution by the pool.- Returns:
- the total number of tasks that have ever been scheduled for execution by the pool
 
 - 
getCompletedTaskCountpublic long getCompletedTaskCount() Return the total number of tasks that have completed execution by the pool.- Returns:
- the total number of tasks that have completed execution by the pool
 
 - 
isDaemonpublic boolean isDaemon() 
 - 
getMaxIdleTimepublic long getMaxIdleTime() 
 - 
setDaemonpublic void setDaemon(boolean daemon) 
 - 
setMaxIdleTimepublic void setMaxIdleTime(long maxIdleTime) 
 
- 
 
-