org.apache.catalina.cluster.tcp
Class ReplicationListener

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

public class ReplicationListener
extends java.lang.Object
implements java.lang.Runnable, ClusterReceiver

FIXME i18n log messages FIXME jmx support

Version:
$Revision: 1.20 $ $Date: 2005/03/25 22:10:25 $
Author:
Peter Rossbach, Filip Hanik

Field Summary
protected  StringManager sm
          The string manager for this package.
 
Constructor Summary
ReplicationListener()
           
 
Method Summary
 CatalinaCluster getCatalinaCluster()
          get Callback
 java.lang.String getHost()
          get the listing ip interface
 java.lang.Object getInterestOpsMutex()
           
 int getPort()
          get the listing ip port
 java.lang.String getTcpListenAddress()
           
 int getTcpListenPort()
           
 long getTcpSelectorTimeout()
           
 int getTcpThreadCount()
           
 boolean isCompress()
           
 boolean isSendAck()
          Send Ack to sender or not
 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 run()
           
 void setCatalinaCluster(CatalinaCluster cluster)
          set callback
 void setCompress(boolean compressMessageData)
           
 void setSendAck(boolean sendAck)
          set ack mode
 void setTcpListenAddress(java.lang.String tcpListenAddress)
           
 void setTcpListenPort(int tcpListenPort)
           
 void setTcpSelectorTimeout(long tcpSelectorTimeout)
           
 void setTcpThreadCount(int tcpThreadCount)
           
 void start()
          start cluster receiver
 void stop()
          Stop message listing
 void stopListening()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sm

protected StringManager sm
The string manager for this package.

Constructor Detail

ReplicationListener

public ReplicationListener()
Method Detail

isCompress

public boolean isCompress()
Returns:
Returns the compress.

setCompress

public void setCompress(boolean compressMessageData)

start

public void start()
start cluster receiver

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

stop

public void stop()
Description copied from interface: ClusterReceiver
Stop message listing

Specified by:
stop in interface ClusterReceiver

run

public void run()
Specified by:
run in interface java.lang.Runnable

listen

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

Throws:
java.lang.Exception

stopListening

public void stopListening()

setCatalinaCluster

public void setCatalinaCluster(CatalinaCluster cluster)
Description copied from interface: ClusterReceiver
set callback

Specified by:
setCatalinaCluster in interface ClusterReceiver
Parameters:
cluster -
See Also:
SimpleTcpCluster.messageDataReceived(byte[])

getCatalinaCluster

public CatalinaCluster getCatalinaCluster()
Description copied from interface: ClusterReceiver
get Callback

Specified by:
getCatalinaCluster in interface ClusterReceiver
Returns:

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

getTcpListenAddress

public java.lang.String getTcpListenAddress()

setTcpListenAddress

public void setTcpListenAddress(java.lang.String tcpListenAddress)

getTcpListenPort

public int getTcpListenPort()

setTcpListenPort

public void setTcpListenPort(int tcpListenPort)

getTcpSelectorTimeout

public long getTcpSelectorTimeout()

setTcpSelectorTimeout

public void setTcpSelectorTimeout(long tcpSelectorTimeout)

getTcpThreadCount

public int getTcpThreadCount()

setTcpThreadCount

public void setTcpThreadCount(int tcpThreadCount)

isSendAck

public boolean isSendAck()
Description copied from interface: ClusterReceiver
Send Ack to sender or not

Specified by:
isSendAck in interface ClusterReceiver
Returns:

setSendAck

public void setSendAck(boolean sendAck)
Description copied from interface: ClusterReceiver
set ack mode

Specified by:
setSendAck in interface ClusterReceiver
Parameters:
sendAck -

getHost

public java.lang.String getHost()
Description copied from interface: ClusterReceiver
get the listing ip interface

Specified by:
getHost in interface ClusterReceiver
Returns:

getPort

public int getPort()
Description copied from interface: ClusterReceiver
get the listing ip port

Specified by:
getPort in interface ClusterReceiver
Returns:

getInterestOpsMutex

public java.lang.Object getInterestOpsMutex()


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