org.apache.catalina.cluster.tcp
Class ReplicationListener

java.lang.Object
  extended byorg.apache.catalina.cluster.tcp.ClusterReceiverBase
      extended byorg.apache.catalina.cluster.tcp.ReplicationListener
All Implemented Interfaces:
ClusterReceiver, ListenCallback, java.lang.Runnable

public class ReplicationListener
extends ClusterReceiverBase

FIXME i18n log messages FIXME jmx support

Version:
$Id: ReplicationListener.java 939539 2010-04-30 01:31:33Z kkolinko $
Author:
Peter Rossbach, Filip Hanik

Field Summary
 
Fields inherited from class org.apache.catalina.cluster.tcp.ClusterReceiverBase
doListen, doReceivedProcessingStats, log, maxReceivedProcessingTime, minReceivedProcessingTime, receivedProcessingTime, sm, totalReceivedBytes
 
Constructor Summary
ReplicationListener()
           
 
Method Summary
 java.lang.String getInfo()
          Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version>.
 java.lang.Object getInterestOpsMutex()
           
 long getTcpSelectorTimeout()
           
 int getTcpThreadCount()
           
protected  void listen()
          get data from channel and store in byte array send it to cluster
protected  void readDataFromSocket(java.nio.channels.SelectionKey key)
          Sample data handler method for a channel with data ready to read.
protected  void registerChannel(java.nio.channels.Selector selector, java.nio.channels.SelectableChannel channel, int ops, java.lang.Object attach)
          Register the given channel with the given selector for the given operations of interest
 void setTcpSelectorTimeout(long tcpSelectorTimeout)
           
 void setTcpThreadCount(int tcpThreadCount)
           
 void start()
          start cluster receiver
protected  void stopListening()
          Close Selector.
 
Methods inherited from class org.apache.catalina.cluster.tcp.ClusterReceiverBase
addReceivedProcessingStats, deserialize, getAvgReceivedProcessingTime, getAvgTotalReceivedBytes, getBind, getCatalinaCluster, getHost, getLastChecked, getMaxReceivedProcessingTime, getMinReceivedProcessingTime, getNrOfMsgsReceived, getObjectName, getPort, getReceivedProcessingTime, getReceivedTime, getRxBufSize, getSoLingerTime, getSoTrafficClass, getTcpListenAddress, getTcpListenPort, getTimeout, getTotalReceivedBytes, getTxBufSize, isCompress, isDoListen, isDoReceivedProcessingStats, isOoBInline, isSendAck, isSoKeepAlive, isSoLingerOn, isSoReuseAddress, isTcpNoDelay, messageDataReceived, registerReceiverMBean, resetStatistics, run, sendAck, setBind, setCatalinaCluster, setCompress, setDoReceivedProcessingStats, setObjectName, setOoBInline, setRxBufSize, setSendAck, setSoKeepAlive, setSoLingerOn, setSoLingerTime, setSoReuseAddress, setSoTrafficClass, setTcpListenAddress, setTcpListenPort, setTcpNoDelay, setTimeout, setTxBufSize, stop, unregisterRecevierMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationListener

public ReplicationListener()
Method Detail

getInfo

public java.lang.String getInfo()
Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version>.


getTcpSelectorTimeout

public long getTcpSelectorTimeout()

setTcpSelectorTimeout

public void setTcpSelectorTimeout(long tcpSelectorTimeout)

getTcpThreadCount

public int getTcpThreadCount()

setTcpThreadCount

public void setTcpThreadCount(int tcpThreadCount)

getInterestOpsMutex

public java.lang.Object getInterestOpsMutex()

start

public void start()
start cluster receiver

Specified by:
start in interface ClusterReceiver
Overrides:
start in class ClusterReceiverBase
Throws:
java.lang.Exception
See Also:
ClusterReceiver.start()

listen

protected void listen()
               throws java.lang.Exception
get data from channel and store in byte array send it to cluster

Specified by:
listen in class ClusterReceiverBase
Throws:
IOException
java.nio.channels.ClosedChannelException
java.lang.Exception

stopListening

protected void stopListening()
Close Selector.

Specified by:
stopListening in class ClusterReceiverBase
See Also:
ClusterReceiverBase.stopListening()

registerChannel

protected void registerChannel(java.nio.channels.Selector selector,
                               java.nio.channels.SelectableChannel channel,
                               int ops,
                               java.lang.Object attach)
                        throws java.lang.Exception
Register the given channel with the given selector for the given operations of interest

Throws:
java.lang.Exception

readDataFromSocket

protected void readDataFromSocket(java.nio.channels.SelectionKey key)
                           throws java.lang.Exception
Sample data handler method for a channel with data ready to read.

Parameters:
key - A SelectionKey object associated with a channel determined by the selector to be ready for reading. If the channel returns an EOF condition, it is closed here, which automatically invalidates the associated key. The selector will then de-register the channel on the next select call.
Throws:
java.lang.Exception


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