org.apache.catalina.cluster.tcp
Class SocketReplicationListener

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

public class SocketReplicationListener
extends ClusterReceiverBase

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

Field Summary
protected static StringManager sm
          The string manager for this package.
 
Fields inherited from class org.apache.catalina.cluster.tcp.ClusterReceiverBase
doListen, doReceivedProcessingStats, maxReceivedProcessingTime, minReceivedProcessingTime, receivedProcessingTime, totalReceivedBytes
 
Constructor Summary
SocketReplicationListener()
           
 
Method Summary
protected  java.net.ServerSocket createServerSocket()
          create a Server Socket between tcpListenerPort and tcpListenMaxPort
 java.lang.String getInfo()
          Return descriptive information about this implementation and the corresponding version number, in the format <description>/<version>.
 int getTcpListenMaxPort()
           
 int getTcpListenTimeout()
           
protected  void listen()
          Master/Slave sender handling bind server socket to address and port
 void setTcpListenMaxPort(int maxListenPort)
           
 void setTcpListenTimeout(int tcpListenTimeout)
           
 void start()
          Wait the createServerSocket find the correct socket port when default config is used.
protected  void stopListening()
          Close serverSockets FIXME the channelSocket to connect own socket to terminate accpet loop!
protected  void unLockSocket()
          Need to create a connection to unlock the ServerSocker#accept().
 
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
 

Field Detail

sm

protected static StringManager sm
The string manager for this package.

Constructor Detail

SocketReplicationListener

public SocketReplicationListener()
Method Detail

getInfo

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


getTcpListenMaxPort

public int getTcpListenMaxPort()
Returns:
Returns the tcpListenMaxPort.

setTcpListenMaxPort

public void setTcpListenMaxPort(int maxListenPort)
Parameters:
maxListenPort - The tcpListenMaxPort to set.

getTcpListenTimeout

public int getTcpListenTimeout()
Returns:
Returns the tcpListenTimeout.

setTcpListenTimeout

public void setTcpListenTimeout(int tcpListenTimeout)
Parameters:
tcpListenTimeout - The tcpListenTimeout to set.

start

public void start()
Wait the createServerSocket find the correct socket port when default config is used.

Specified by:
start in interface ClusterReceiver
Overrides:
start in class ClusterReceiverBase
See Also:
ClusterReceiver.start(), createServerSocket()

listen

protected void listen()
Master/Slave sender handling bind server socket to address and port

Specified by:
listen in class ClusterReceiverBase
Throws:
java.lang.Exception

createServerSocket

protected java.net.ServerSocket createServerSocket()
create a Server Socket between tcpListenerPort and tcpListenMaxPort


unLockSocket

protected void unLockSocket()
Need to create a connection to unlock the ServerSocker#accept(). Very fine trick from channelSocket :-) See org.apache.jk.common.ChannelSocket's unLockSocket method (it's private, so you may need to inspect the source).


stopListening

protected void stopListening()
Close serverSockets FIXME the channelSocket to connect own socket to terminate accpet loop!

Specified by:
stopListening in class ClusterReceiverBase


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