## org.apache.catalina.cluster.tcp
Class ClusterReceiverBase

    java.lang.Object
      org.apache.catalina.cluster.tcp.ClusterReceiverBase

All Implemented Interfaces:
  ClusterReceiver, ListenCallback, java.lang.Runnable

Direct Known Subclasses:
  ReplicationListener, SocketReplicationListener

public abstract class ClusterReceiverBase
extends java.lang.Object
implements java.lang.Runnable, ClusterReceiver, ListenCallback

FIXME i18n log messages

Version:
  $Id: ClusterReceiverBase.java 939539 2010-04-30 01:31:33Z kkolinko $
Author:
  Peter Rossbach

Field Summary
`protected boolean` `doListen`
`protected boolean` `doReceivedProcessingStats` doProcessingStats
`protected static org.apache.commons.logging.Log` `log`
`protected long` `maxReceivedProcessingTime` max proessingTime
`protected long` `minReceivedProcessingTime` min proessingTime
`protected long` `receivedProcessingTime` proessingTime
`protected StringManager` `sm` The string manager for this package.
`protected long` `totalReceivedBytes` total bytes to recevied

Constructor Summary
`ClusterReceiverBase()`

Method Summary
`protected void` `addReceivedProcessingStats(long startTime)` Add receiver processing stats times
`protected ClusterMessage` `deserialize(ClusterData data)` deserialize the receieve cluster message
`double` `getAvgReceivedProcessingTime()`
`long` `getAvgTotalReceivedBytes()`
`java.net.InetAddress` `getBind()`
`CatalinaCluster` `getCatalinaCluster()` get Callback.
`java.lang.String` `getHost()` get the listing ip interface
`long` `getLastChecked()`
`long` `getMaxReceivedProcessingTime()`
`long` `getMinReceivedProcessingTime()`
`long` `getNrOfMsgsReceived()`
`javax.management.ObjectName` `getObjectName()` Receiver ObjectName
`int` `getPort()` get the listing ip port
`long` `getReceivedProcessingTime()`
`long` `getReceivedTime()`
`int` `getRxBufSize()`
`int` `getSoLingerTime()`
`int` `getSoTrafficClass()`
`java.lang.String` `getTcpListenAddress()` get tcp listen recevier ip address
`int` `getTcpListenPort()`
`int` `getTimeout()`
`long` `getTotalReceivedBytes()`
`int` `getTxBufSize()`
`boolean` `isCompress()`
`boolean` `isDoListen()`
`boolean` `isDoReceivedProcessingStats()`
`boolean` `isOoBInline()`
`boolean` `isSendAck()` Send ACK to sender
`boolean` `isSoKeepAlive()`
`boolean` `isSoLingerOn()`
`boolean` `isSoReuseAddress()`
`boolean` `isTcpNoDelay()`
`protected abstract void` `listen()` Start Listener
`void` `messageDataReceived(ClusterData data)` receiver Message from other node.
`protected void` `registerReceiverMBean()` Register Receiver MBean <domain>:type=ClusterReceiver,host=<host>
`void` `resetStatistics()` Reset sender statistics
`void` `run()` Start thread and listen
`void` `sendAck()` send ack
`void` `setBind(java.net.InetAddress bind)`
`void` `setCatalinaCluster(CatalinaCluster cluster)` set callback.
`void` `setCompress(boolean compressMessageData)`
`void` `setDoReceivedProcessingStats(boolean doReceiverProcessingStats)`
`void` `setObjectName(javax.management.ObjectName name)` set Receiver ObjectName
`void` `setOoBInline(boolean ooBInline)`
`void` `setRxBufSize(int rxBufSize)`
`void` `setSendAck(boolean sendAck)` set ack mode or not!
`void` `setSoKeepAlive(boolean soKeepAlive)`
`void` `setSoLingerOn(boolean soLingerOn)`
`void` `setSoLingerTime(int soLingerTime)`
`void` `setSoReuseAddress(boolean soReuseAddress)`
`void` `setSoTrafficClass(int soTrafficClass)`
`void` `setTcpListenAddress(java.lang.String tcpListenAddress)` Set TCP listen ip address.
`void` `setTcpListenPort(int tcpListenPort)`
`void` `setTcpNoDelay(boolean tcpNoDelay)`
`void` `setTimeout(int timeout)`
`void` `setTxBufSize(int txBufSize)`
`void` `start()` start cluster receiver
`void` `stop()` Stop accept
`protected abstract void` `stopListening()` stop Listener sockets
`protected void` `unregisterRecevierMBean()` UnRegister Recevier MBean <domain>:type=ClusterReceiver,host=<host>

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static org.apache.commons.logging.Log log

### sm

    protected StringManager sm

  The string manager for this package.

### doListen

    protected boolean doListen

### totalReceivedBytes

    protected long totalReceivedBytes

  total bytes to recevied

### doReceivedProcessingStats

    protected boolean doReceivedProcessingStats

  doProcessingStats

### receivedProcessingTime

    protected long receivedProcessingTime

  proessingTime

### minReceivedProcessingTime

    protected long minReceivedProcessingTime

  min proessingTime

### maxReceivedProcessingTime

    protected long maxReceivedProcessingTime

  max proessingTime

Constructor Detail

### ClusterReceiverBase

    public ClusterReceiverBase()

Method Detail

### isOoBInline

    public boolean isOoBInline()

  Returns:
    the ooBInline

### setOoBInline

    public void setOoBInline(boolean ooBInline)

  Parameters:
    `ooBInline` - the ooBInline to set

### getRxBufSize

    public int getRxBufSize()

  Returns:
    the rxBufSize

### setRxBufSize

    public void setRxBufSize(int rxBufSize)

  Parameters:
    `rxBufSize` - the rxBufSize to set

### isSoKeepAlive

    public boolean isSoKeepAlive()

  Returns:
    the soKeepAlive

### setSoKeepAlive

    public void setSoKeepAlive(boolean soKeepAlive)

  Parameters:
    `soKeepAlive` - the soKeepAlive to set

### isSoLingerOn

    public boolean isSoLingerOn()

  Returns:
    the soLingerOn

### setSoLingerOn

    public void setSoLingerOn(boolean soLingerOn)

  Parameters:
    `soLingerOn` - the soLingerOn to set

### getSoLingerTime

    public int getSoLingerTime()

  Returns:
    the soLingerTime

### setSoLingerTime

    public void setSoLingerTime(int soLingerTime)

  Parameters:
    `soLingerTime` - the soLingerTime to set

### isSoReuseAddress

    public boolean isSoReuseAddress()

  Returns:
    the soReuseAddress

### setSoReuseAddress

    public void setSoReuseAddress(boolean soReuseAddress)

  Parameters:
    `soReuseAddress` - the soReuseAddress to set

### getSoTrafficClass

    public int getSoTrafficClass()

  Returns:
    the soTrafficClass

### setSoTrafficClass

    public void setSoTrafficClass(int soTrafficClass)

  Parameters:
    `soTrafficClass` - the soTrafficClass to set

### isTcpNoDelay

    public boolean isTcpNoDelay()

  Returns:
    the tcpNoDelay

### setTcpNoDelay

    public void setTcpNoDelay(boolean tcpNoDelay)

  Parameters:
    `tcpNoDelay` - the tcpNoDelay to set

### getTimeout

    public int getTimeout()

  Returns:
    the timeout

### setTimeout

    public void setTimeout(int timeout)

  Parameters:
    `timeout` - the timeout to set

### getTxBufSize

    public int getTxBufSize()

  Returns:
    the txBufSize

### setTxBufSize

    public void setTxBufSize(int txBufSize)

  Parameters:
    `txBufSize` - the txBufSize to set

### isDoListen

    public boolean isDoListen()

  Returns:
    Returns the doListen.

### getBind

    public java.net.InetAddress getBind()

  Returns:
    Returns the bind.

### setBind

    public void setBind(java.net.InetAddress bind)

  Parameters:
    `bind` - The bind to set.

### setCatalinaCluster

    public void setCatalinaCluster(CatalinaCluster cluster)

  Description copied from interface: `ClusterReceiver`
  set callback.

  Specified by:
    `setCatalinaCluster` in interface `ClusterReceiver`
  Parameters:
    `cluster` - The cluster

### getCatalinaCluster

    public CatalinaCluster getCatalinaCluster()

  Description copied from interface: `ClusterReceiver`
  get Callback.

  Specified by:
    `getCatalinaCluster` in interface `ClusterReceiver`
  Returns:
    The cluster

### setObjectName

    public void setObjectName(javax.management.ObjectName name)

  set Receiver ObjectName

  Parameters:
    `name` -

### getObjectName

    public javax.management.ObjectName getObjectName()

  Receiver ObjectName

### isCompress

    public boolean isCompress()

  Specified by:
    `isCompress` in interface `ClusterReceiver`
  Returns:
    Returns the compress.

### setCompress

    public void setCompress(boolean compressMessageData)

  Specified by:
    `setCompress` in interface `ClusterReceiver`
  Parameters:
    `compressMessageData` - The compress to set.

### isSendAck

    public boolean isSendAck()

  Send ACK to sender

  Specified by:
    `isSendAck` in interface `ClusterReceiver`
  Returns:
    True if sending ACK

### setSendAck

    public void setSendAck(boolean sendAck)

  set ack mode or not!

  Specified by:
    `setSendAck` in interface `ClusterReceiver`
  Parameters:
    `sendAck` -

### getTcpListenAddress

    public java.lang.String getTcpListenAddress()

  get tcp listen recevier ip address

  Returns:
    listen address

### setTcpListenAddress

    public void setTcpListenAddress(java.lang.String tcpListenAddress)

  Set TCP listen ip address. If arg auto use InetAddress.getLocalHost() otherwise arg converted with InetAddress.getByName().

  Parameters:
    `tcpListenAddress` -

### getTcpListenPort

    public int getTcpListenPort()

### setTcpListenPort

    public void setTcpListenPort(int tcpListenPort)

### getHost

    public java.lang.String getHost()

  Description copied from interface: `ClusterReceiver`
  get the listing ip interface

  Specified by:
    `getHost` in interface `ClusterReceiver`
  Returns:
    The host

### getPort

    public int getPort()

  Description copied from interface: `ClusterReceiver`
  get the listing ip port

  Specified by:
    `getPort` in interface `ClusterReceiver`
  Returns:
    The port

### isDoReceivedProcessingStats

    public boolean isDoReceivedProcessingStats()

  Returns:
    Returns the doReceivedProcessingStats.

### setDoReceivedProcessingStats

    public void setDoReceivedProcessingStats(boolean doReceiverProcessingStats)

  Parameters:
    `doReceiverProcessingStats` - The doReceivedProcessingStats to set.

### getMaxReceivedProcessingTime

    public long getMaxReceivedProcessingTime()

  Returns:
    Returns the maxReceivedProcessingTime.

### getMinReceivedProcessingTime

    public long getMinReceivedProcessingTime()

  Returns:
    Returns the minReceivedProcessingTime.

### getReceivedProcessingTime

    public long getReceivedProcessingTime()

  Returns:
    Returns the receivedProcessingTime.

### getTotalReceivedBytes

    public long getTotalReceivedBytes()

  Returns:
    Returns the totalReceivedBytes.

### getAvgReceivedProcessingTime

    public double getAvgReceivedProcessingTime()

  Returns:
    Returns the avg receivedProcessingTime/nrOfMsgsReceived.

### getAvgTotalReceivedBytes

    public long getAvgTotalReceivedBytes()

  Returns:
    Returns the avg totalReceivedBytes/nrOfMsgsReceived.

### getReceivedTime

    public long getReceivedTime()

  Returns:
    Returns the receivedTime.

### getLastChecked

    public long getLastChecked()

  Returns:
    Returns the lastChecked.

### getNrOfMsgsReceived

    public long getNrOfMsgsReceived()

  Returns:
    Returns the nrOfMsgsReceived.

### start

    public void start()

  start cluster receiver

  Specified by:
    `start` in interface `ClusterReceiver`
  See Also:
    `ClusterReceiver.start()`

### stop

    public void stop()

  Stop accept

  Specified by:
    `stop` in interface `ClusterReceiver`
  See Also:
    `ClusterReceiver.stop()`, `stopListening()`

### registerReceiverMBean

    protected void registerReceiverMBean()

  Register Receiver MBean <domain>:type=ClusterReceiver,host=<host>

### unregisterRecevierMBean

    protected void unregisterRecevierMBean()

  UnRegister Recevier MBean <domain>:type=ClusterReceiver,host=<host>

### stopListening

    protected abstract void stopListening()

  stop Listener sockets

### listen

    protected abstract void listen()
                            throws java.lang.Exception

  Start Listener

  Throws:
    `java.lang.Exception`

### run

    public void run()

  Start thread and listen

  Specified by:
    `run` in interface `java.lang.Runnable`

### messageDataReceived

    public void messageDataReceived(ClusterData data)

  receiver Message from other node. All SessionMessage forward to ClusterManager and other message dispatch to all accept MessageListener.

  Specified by:
    `messageDataReceived` in interface `ListenCallback`
  Parameters:
    `data` - - the message bytes received from the cluster/replication system
  See Also:
    `ClusterSessionListener.messageReceived(ClusterMessage)`

### deserialize

    protected ClusterMessage deserialize(ClusterData data)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException

  deserialize the receieve cluster message

  Parameters:
    `data` - uncompress data
  Returns:
    The message
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

### resetStatistics

    public void resetStatistics()

  Reset sender statistics

### addReceivedProcessingStats

    protected void addReceivedProcessingStats(long startTime)

  Add receiver processing stats times

  Parameters:
    `startTime` -

### sendAck

    public void sendAck()
                 throws java.io.IOException

  Description copied from interface: `ListenCallback`
  send ack

  Specified by:
    `sendAck` in interface `ListenCallback`
  Throws:
    `java.io.IOException`

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.