org.apache.catalina.cluster.tcp
Class SimpleTcpCluster

java.lang.Object
  extended byorg.apache.catalina.cluster.tcp.SimpleTcpCluster
All Implemented Interfaces:
CatalinaCluster, Cluster, IDynamicProperty, Lifecycle, LifecycleListener, MembershipListener

public class SimpleTcpCluster
extends java.lang.Object
implements CatalinaCluster, Lifecycle, MembershipListener, LifecycleListener, IDynamicProperty

A Cluster implementation using simple multicast. Responsible for setting up a cluster and provides callers with a valid multicast receiver/sender. FIXME remove install/remove/start/stop context dummys FIXME wrote testcases

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

Field Summary
static java.lang.String AFTER_MANAGERREGISTER_EVENT
           
static java.lang.String AFTER_MANAGERUNREGISTER_EVENT
           
static java.lang.String AFTER_MEMBERREGISTER_EVENT
           
static java.lang.String AFTER_MEMBERUNREGISTER_EVENT
           
static java.lang.String BEFORE_MANAGERREGISTER_EVENT
           
static java.lang.String BEFORE_MANAGERUNREGISTER_EVENT
           
static java.lang.String BEFORE_MEMBERREGISTER_EVENT
           
static java.lang.String BEFORE_MEMBERUNREGISTER_EVENT
           
protected  java.lang.String clusterImpName
          Name for logging purpose
protected  java.util.List clusterListeners
          Listeners of messages
protected  java.lang.String clusterName
          The cluster name to join
protected  Container container
          The Container associated with this Cluster.
protected static java.lang.String info
          Descriptive information about this component implementation.
protected  LifecycleSupport lifecycle
          The lifecycle event support for this component.
static org.apache.commons.logging.Log log
           
protected  java.util.Map managers
          The context name <->manager association for distributed contexts.
protected  MembershipService membershipService
          the service that provides the membership
static java.lang.String RECEIVE_MESSAGE_FAILURE_EVENT
           
static java.lang.String SEND_MESSAGE_FAILURE_EVENT
           
protected  StringManager sm
          The string manager for this package.
protected  boolean started
          Has this component been started?
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
SimpleTcpCluster()
           
 
Method Summary
 void addClusterListener(MessageListener listener)
          add cluster message listener and register cluster to this listener
 void addLifecycleListener(LifecycleListener listener)
          Add a lifecycle event listener to this component.
 void addManager(java.lang.String name, Manager manager)
          add an application to cluster replication bus
 void addValve(Valve valve)
          Add cluster valve Cluster Valves are only add to container when cluster is started!
 void backgroundProcess()
          Execute a periodic task, such as reloading, etc.
protected  void createDefaultClusterListener()
          Create default session cluster listener: <ClusterListener className="org.apache.catalina.cluster.session.ClusterSessionListener" />
protected  void createDefaultClusterReceiver()
          Create default receiver: <Receiver className="org.apache.catalina.cluster.tcp.SocketReplicationListener" tcpListenAddress="auto" tcpListenPort="8015" tcpListenMaxPort="8019" doReceivedProcessingStats="true" />
protected  void createDefaultClusterSender()
          Create default cluster sender <Sender className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" replicationMode="fastasyncqueue" doTransmitterProcessingStats="true" doProcessingStats="true"/>
protected  void createDefaultClusterValves()
          Create default ReplicationValve <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve" filter=".*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;" primaryIndicator="true" />
protected  void createDefaultMembershipService()
          Create default membership service: <Membership className="org.apache.catalina.cluster.mcast.McastService" mcastAddr="228.0.0.4" mcastPort="8012" mcastFrequency="1000" mcastDropTime="30000"/>
 Manager createManager(java.lang.String name)
          Create new Manager without add to cluster (comes with start the manager)
 MessageListener[] findClusterListeners()
          Get the cluster listeners associated with this cluster.
 LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
 ClusterDeployer getClusterDeployer()
          get current Deployer
 org.apache.commons.logging.Log getClusterLog()
           
 java.lang.String getClusterLogName()
           
 java.lang.String getClusterName()
          Return the name of the cluster that this Server is currently configured to operate within.
 ClusterReceiver getClusterReceiver()
           
 ClusterSender getClusterSender()
           
 Container getContainer()
          Get the Container associated with our Cluster
 java.lang.String getInfo()
          Return descriptive information about this Cluster implementation and the corresponding version number, in the format <description>/<version>.
 Member getLocalMember()
          Return the member that represents this node.
 org.apache.commons.logging.Log getLogger()
          Returns the associates logger with this cluster.
 javax.management.modelmbean.ModelMBean getManagedBean(java.lang.Object object)
          Returns the ModelMBean
 Manager getManager(java.lang.String name)
           
 java.lang.String getManagerClassName()
           
 java.lang.String getManagerName(java.lang.String name, Manager manager)
          Returns the name for the cluster manager.
 java.util.Map getManagers()
           
 javax.management.MBeanServer getMBeanServer()
          Get current Catalina MBean Server and load mbean registry
 Member[] getMembers()
          Get all current cluster members
 MembershipService getMembershipService()
           
 javax.management.ObjectName getObjectName()
           
 java.lang.Object getProperty(java.lang.String key)
          get current config
 java.util.Iterator getPropertyNames()
          Get all properties keys
 java.lang.String getProtocol()
          Get the protocol used by the cluster.
 Valve[] getValves()
          get all cluster valves
 boolean hasMembers()
          has members
 void installContext(java.lang.String contextPath, java.net.URL war)
          Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path.
 boolean isDefaultMode()
           
 boolean isDoClusterLog()
           
 boolean isNotifyLifecycleListenerOnFailure()
           
 void lifecycleEvent(LifecycleEvent lifecycleEvent)
          Use as base to handle start/stop/periodic Events from host.
protected  void logReceiveMessage(ClusterMessage message, long start, boolean accepted)
          log received message to cluster transfer log
protected  void logSendMessage(ClusterMessage message, long start, Member dest)
          log sended message to cluster transfer log
 void memberAdded(Member member)
          New cluster member is registered
 void memberDisappeared(Member member)
          Cluster member is gone
 void receive(ClusterMessage message)
          notify all listeners from receiving a new message is not ClusterMessage emitt Failure Event to LifecylceListener
protected  void registerClusterValve()
          register all cluster valve to host or engine
protected  void registerMBeans()
          register Means at cluster.
 void removeClusterListener(MessageListener listener)
          remove message listener and deregister Cluster from listener
 void removeLifecycleListener(LifecycleListener listener)
          Remove a lifecycle event listener from this component.
 void removeManager(java.lang.String name, Manager manager)
          remove an application form cluster replication bus
 void removeProperty(java.lang.String key)
          remove a configured property.
 void send(ClusterMessage msg)
          send message to all cluster members
 void send(ClusterMessage msg, Member dest)
          send a cluster message to one member
 void sendClusterDomain(ClusterMessage msg)
          send message to all cluster members same cluster domain
 void sendToMember(ClusterMessage msg, java.lang.String dest)
          send a cluster message to one member (very usefull JMX method for remote scripting)
 void setClusterDeployer(ClusterDeployer clusterDeployer)
          set a new Deployer, must be set before cluster started!
 void setClusterLogName(java.lang.String clusterLogName)
           
 void setClusterName(java.lang.String clusterName)
          Set the name of the cluster to join, if no cluster with this name is present create one.
 void setClusterReceiver(ClusterReceiver clusterReceiver)
           
 void setClusterSender(ClusterSender clusterSender)
           
 void setContainer(Container container)
          Set the Container associated with our Cluster
 void setDefaultMode(boolean defaultMode)
           
 void setDoClusterLog(boolean doClusterLog)
           
 void setManagerClassName(java.lang.String managerClassName)
           
 void setMembershipService(MembershipService membershipService)
           
 void setNotifyLifecycleListenerOnFailure(boolean notifyListenerOnFailure)
           
 void setObjectName(javax.management.ObjectName name)
           
 void setProperty(java.lang.String name, java.lang.Object value)
          set config attributes with reflect and propagate to all managers
 void setProperty(java.lang.String name, java.lang.String value)
          JMX hack to direct use at jconsole
 void setProtocol(java.lang.String protocol)
          Set the protocol parameters.
 void start()
          Prepare for the beginning of active use of the public methods of this component.
 void startContext(java.lang.String contextPath)
          Start an existing web application, attached to the specified context path in all the other nodes in the cluster.
 void stop()
          Gracefully terminate the active cluster component.
 void stop(java.lang.String contextPath)
          Stop an existing web application, attached to the specified context path.
protected  void transferProperty(java.lang.String prefix, java.lang.Object bean)
          transfer properties from cluster configuration to subelement bean.
protected  void unregisterClusterValve()
          unregister all cluster valve to host or engine
protected  void unregisterMBeans()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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

info

protected static final java.lang.String info
Descriptive information about this component implementation.

See Also:
Constant Field Values

BEFORE_MEMBERREGISTER_EVENT

public static final java.lang.String BEFORE_MEMBERREGISTER_EVENT
See Also:
Constant Field Values

AFTER_MEMBERREGISTER_EVENT

public static final java.lang.String AFTER_MEMBERREGISTER_EVENT
See Also:
Constant Field Values

BEFORE_MANAGERREGISTER_EVENT

public static final java.lang.String BEFORE_MANAGERREGISTER_EVENT
See Also:
Constant Field Values

AFTER_MANAGERREGISTER_EVENT

public static final java.lang.String AFTER_MANAGERREGISTER_EVENT
See Also:
Constant Field Values

BEFORE_MANAGERUNREGISTER_EVENT

public static final java.lang.String BEFORE_MANAGERUNREGISTER_EVENT
See Also:
Constant Field Values

AFTER_MANAGERUNREGISTER_EVENT

public static final java.lang.String AFTER_MANAGERUNREGISTER_EVENT
See Also:
Constant Field Values

BEFORE_MEMBERUNREGISTER_EVENT

public static final java.lang.String BEFORE_MEMBERUNREGISTER_EVENT
See Also:
Constant Field Values

AFTER_MEMBERUNREGISTER_EVENT

public static final java.lang.String AFTER_MEMBERUNREGISTER_EVENT
See Also:
Constant Field Values

SEND_MESSAGE_FAILURE_EVENT

public static final java.lang.String SEND_MESSAGE_FAILURE_EVENT
See Also:
Constant Field Values

RECEIVE_MESSAGE_FAILURE_EVENT

public static final java.lang.String RECEIVE_MESSAGE_FAILURE_EVENT
See Also:
Constant Field Values

membershipService

protected MembershipService membershipService
the service that provides the membership


clusterImpName

protected java.lang.String clusterImpName
Name for logging purpose


sm

protected StringManager sm
The string manager for this package.


clusterName

protected java.lang.String clusterName
The cluster name to join


container

protected Container container
The Container associated with this Cluster.


lifecycle

protected LifecycleSupport lifecycle
The lifecycle event support for this component.


started

protected boolean started
Has this component been started?


support

protected java.beans.PropertyChangeSupport support
The property change support for this component.


managers

protected java.util.Map managers
The context name <->manager association for distributed contexts.


clusterListeners

protected java.util.List clusterListeners
Listeners of messages

Constructor Detail

SimpleTcpCluster

public SimpleTcpCluster()
Method Detail

getInfo

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

Specified by:
getInfo in interface Cluster

setClusterName

public void setClusterName(java.lang.String clusterName)
Set the name of the cluster to join, if no cluster with this name is present create one.

Specified by:
setClusterName in interface Cluster
Parameters:
clusterName - The clustername to join

getClusterName

public java.lang.String getClusterName()
Return the name of the cluster that this Server is currently configured to operate within.

Specified by:
getClusterName in interface Cluster
Returns:
The name of the cluster associated with this server

setContainer

public void setContainer(Container container)
Set the Container associated with our Cluster

Specified by:
setContainer in interface Cluster
Parameters:
container - The Container to use

getContainer

public Container getContainer()
Get the Container associated with our Cluster

Specified by:
getContainer in interface Cluster
Returns:
The Container associated with our Cluster

isNotifyLifecycleListenerOnFailure

public boolean isNotifyLifecycleListenerOnFailure()
Returns:
Returns the notifyLifecycleListenerOnFailure.

setNotifyLifecycleListenerOnFailure

public void setNotifyLifecycleListenerOnFailure(boolean notifyListenerOnFailure)
Parameters:
notifyListenerOnFailure - The notifyLifecycleListenerOnFailure to set.

isDefaultMode

public boolean isDefaultMode()
Returns:
Returns the defaultMode.

setDefaultMode

public void setDefaultMode(boolean defaultMode)
Parameters:
defaultMode - The defaultMode to set.

getManagerClassName

public java.lang.String getManagerClassName()

setManagerClassName

public void setManagerClassName(java.lang.String managerClassName)

getClusterSender

public ClusterSender getClusterSender()
Specified by:
getClusterSender in interface CatalinaCluster

setClusterSender

public void setClusterSender(ClusterSender clusterSender)
Specified by:
setClusterSender in interface CatalinaCluster

getClusterReceiver

public ClusterReceiver getClusterReceiver()
Specified by:
getClusterReceiver in interface CatalinaCluster

setClusterReceiver

public void setClusterReceiver(ClusterReceiver clusterReceiver)
Specified by:
setClusterReceiver in interface CatalinaCluster

getMembershipService

public MembershipService getMembershipService()
Specified by:
getMembershipService in interface CatalinaCluster

setMembershipService

public void setMembershipService(MembershipService membershipService)
Specified by:
setMembershipService in interface CatalinaCluster

addValve

public void addValve(Valve valve)
Add cluster valve Cluster Valves are only add to container when cluster is started!

Specified by:
addValve in interface CatalinaCluster
Parameters:
valve - The new cluster Valve.

getValves

public Valve[] getValves()
get all cluster valves

Specified by:
getValves in interface CatalinaCluster
Returns:
current cluster valves

findClusterListeners

public MessageListener[] findClusterListeners()
Get the cluster listeners associated with this cluster. If this Array has no listeners registered, a zero-length array is returned.


addClusterListener

public void addClusterListener(MessageListener listener)
add cluster message listener and register cluster to this listener

Specified by:
addClusterListener in interface CatalinaCluster
See Also:
CatalinaCluster.addClusterListener(org.apache.catalina.cluster.MessageListener)

removeClusterListener

public void removeClusterListener(MessageListener listener)
remove message listener and deregister Cluster from listener

Specified by:
removeClusterListener in interface CatalinaCluster
See Also:
CatalinaCluster.removeClusterListener(org.apache.catalina.cluster.MessageListener)

getClusterDeployer

public ClusterDeployer getClusterDeployer()
get current Deployer

Specified by:
getClusterDeployer in interface CatalinaCluster

setClusterDeployer

public void setClusterDeployer(ClusterDeployer clusterDeployer)
set a new Deployer, must be set before cluster started!

Specified by:
setClusterDeployer in interface CatalinaCluster

hasMembers

public boolean hasMembers()
has members

Specified by:
hasMembers in interface CatalinaCluster

getMembers

public Member[] getMembers()
Get all current cluster members

Specified by:
getMembers in interface CatalinaCluster
Returns:
all members or empty array

getLocalMember

public Member getLocalMember()
Return the member that represents this node.

Specified by:
getLocalMember in interface CatalinaCluster
Returns:
Member

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
JMX hack to direct use at jconsole

Parameters:
name -
value -

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
set config attributes with reflect and propagate to all managers

Specified by:
setProperty in interface IDynamicProperty
Parameters:
name -
value -

getProperty

public java.lang.Object getProperty(java.lang.String key)
get current config

Specified by:
getProperty in interface IDynamicProperty
Parameters:
key -
Returns:
The property

getPropertyNames

public java.util.Iterator getPropertyNames()
Get all properties keys

Specified by:
getPropertyNames in interface IDynamicProperty
Returns:
An iterator over the property names.

removeProperty

public void removeProperty(java.lang.String key)
remove a configured property.

Specified by:
removeProperty in interface IDynamicProperty
Parameters:
key -

transferProperty

protected void transferProperty(java.lang.String prefix,
                                java.lang.Object bean)
transfer properties from cluster configuration to subelement bean.

Parameters:
prefix -
bean -

getManagers

public java.util.Map getManagers()
Specified by:
getManagers in interface CatalinaCluster
Returns:
Returns the managers.

createManager

public Manager createManager(java.lang.String name)
Create new Manager without add to cluster (comes with start the manager)

Specified by:
createManager in interface Cluster
Parameters:
name - Context Name of this manager
See Also:
Cluster.createManager(java.lang.String), addManager(String, Manager), DeltaManager.start()

removeManager

public void removeManager(java.lang.String name,
                          Manager manager)
remove an application form cluster replication bus

Specified by:
removeManager in interface CatalinaCluster
See Also:
CatalinaCluster.removeManager(java.lang.String,Manager)

addManager

public void addManager(java.lang.String name,
                       Manager manager)
add an application to cluster replication bus

Specified by:
addManager in interface CatalinaCluster
Parameters:
name - of the context
manager - manager to register
See Also:
CatalinaCluster.addManager(java.lang.String, org.apache.catalina.Manager)

getManagerName

public java.lang.String getManagerName(java.lang.String name,
                                       Manager manager)
Returns the name for the cluster manager. This name depends on whether the cluster manager is defined inside a Host or an Engine. Should the cluster be defined in the Engine element, the manager name is Host.getName+"#"+Context.getManager().getName() otherwise the name is simply Context.getManager().getName()

Parameters:
name - The current name
manager - The cluster manager implementation
Returns:
The name to use for the cluster manager

getManager

public Manager getManager(java.lang.String name)
Specified by:
getManager in interface CatalinaCluster

backgroundProcess

public void backgroundProcess()
Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of this container. Unexpected throwables will be caught and logged.

Specified by:
backgroundProcess in interface Cluster
See Also:
FarmWarDeployer.backgroundProcess(), ReplicationTransmitter.backgroundProcess()

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.

Specified by:
addLifecycleListener in interface Lifecycle
Parameters:
listener - The listener to add

findLifecycleListeners

public LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

Specified by:
findLifecycleListeners in interface Lifecycle

removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.

Specified by:
removeLifecycleListener in interface Lifecycle
Parameters:
listener - The listener to remove

lifecycleEvent

public void lifecycleEvent(LifecycleEvent lifecycleEvent)
Use as base to handle start/stop/periodic Events from host. Currently only log the messages as trace level.

Specified by:
lifecycleEvent in interface LifecycleListener
Parameters:
lifecycleEvent - LifecycleEvent that has occurred
See Also:
LifecycleListener.lifecycleEvent(org.apache.catalina.LifecycleEvent)

start

public void start()
           throws LifecycleException
Prepare for the beginning of active use of the public methods of this component. This method should be called after configure(), and before any of the public methods of the component are utilized.
Starts the cluster communication channel, this will connect with the other nodes in the cluster, and request the current session state to be transferred to this node.

Specified by:
start in interface CatalinaCluster
Throws:
java.lang.IllegalStateException - if this component has already been started
LifecycleException - if this component detects a fatal error that prevents this component from being used

createDefaultMembershipService

protected void createDefaultMembershipService()
Create default membership service:
 <Membership 
             className="org.apache.catalina.cluster.mcast.McastService"
             mcastAddr="228.0.0.4"
             mcastPort="8012"
             mcastFrequency="1000"
             mcastDropTime="30000"/>
 


createDefaultClusterSender

protected void createDefaultClusterSender()
Create default cluster sender
  <Sender
     className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
     replicationMode="fastasyncqueue"
     doTransmitterProcessingStats="true"
     doProcessingStats="true"/>
  


createDefaultClusterReceiver

protected void createDefaultClusterReceiver()
Create default receiver:
   <Receiver 
     className="org.apache.catalina.cluster.tcp.SocketReplicationListener"
     tcpListenAddress="auto"
     tcpListenPort="8015"
     tcpListenMaxPort="8019"
     doReceivedProcessingStats="true"
   />
 


createDefaultClusterListener

protected void createDefaultClusterListener()
Create default session cluster listener:
 <ClusterListener 
   className="org.apache.catalina.cluster.session.ClusterSessionListener" />
 


createDefaultClusterValves

protected void createDefaultClusterValves()
Create default ReplicationValve
 <Valve 
    className="org.apache.catalina.cluster.tcp.ReplicationValve"
    filter=".*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"
    primaryIndicator="true" />
 


registerClusterValve

protected void registerClusterValve()
                             throws java.lang.Exception
register all cluster valve to host or engine

Throws:
java.lang.Exception
java.lang.ClassNotFoundException

unregisterClusterValve

protected void unregisterClusterValve()
                               throws java.lang.Exception
unregister all cluster valve to host or engine

Throws:
java.lang.Exception
java.lang.ClassNotFoundException

stop

public void stop()
          throws LifecycleException
Gracefully terminate the active cluster component.
This will disconnect the cluster communication channel, stop the listener and deregister the valves from host or engine.

Note:
The sub elements receiver, sender, membership, listener or valves are not removed. You can easily start the cluster again.

Specified by:
stop in interface CatalinaCluster
Throws:
java.lang.IllegalStateException - if this component has not been started
LifecycleException - if this component detects a fatal error that needs to be reported

sendClusterDomain

public void sendClusterDomain(ClusterMessage msg)
send message to all cluster members same cluster domain

Specified by:
sendClusterDomain in interface CatalinaCluster
Parameters:
msg - ClusterMessage
See Also:
CatalinaCluster.send(org.apache.catalina.cluster.ClusterMessage)

send

public void send(ClusterMessage msg)
send message to all cluster members

Specified by:
send in interface CatalinaCluster
Parameters:
msg - message to transfer
See Also:
CatalinaCluster.send(org.apache.catalina.cluster.ClusterMessage)

sendToMember

public void sendToMember(ClusterMessage msg,
                         java.lang.String dest)
send a cluster message to one member (very usefull JMX method for remote scripting)

Parameters:
msg - message to transfer
dest - Receiver member with name
See Also:
CatalinaCluster.send(org.apache.catalina.cluster.ClusterMessage, org.apache.catalina.cluster.Member), McastService.findMemberByName(String)

send

public void send(ClusterMessage msg,
                 Member dest)
send a cluster message to one member

Specified by:
send in interface CatalinaCluster
Parameters:
msg - message to transfer
dest - Receiver member
See Also:
CatalinaCluster.send(org.apache.catalina.cluster.ClusterMessage, org.apache.catalina.cluster.Member)

memberAdded

public void memberAdded(Member member)
New cluster member is registered

Specified by:
memberAdded in interface MembershipListener
See Also:
MembershipListener.memberAdded(org.apache.catalina.cluster.Member)

memberDisappeared

public void memberDisappeared(Member member)
Cluster member is gone

Specified by:
memberDisappeared in interface MembershipListener
See Also:
MembershipListener.memberDisappeared(org.apache.catalina.cluster.Member)

receive

public void receive(ClusterMessage message)
notify all listeners from receiving a new message is not ClusterMessage emitt Failure Event to LifecylceListener

Specified by:
receive in interface CatalinaCluster
Parameters:
message - receveived Message

getClusterLogName

public java.lang.String getClusterLogName()
Returns:
Returns the clusterLogName.

setClusterLogName

public void setClusterLogName(java.lang.String clusterLogName)
Parameters:
clusterLogName - The clusterLogName to set.

isDoClusterLog

public boolean isDoClusterLog()
Returns:
Returns the doClusterLog.

setDoClusterLog

public void setDoClusterLog(boolean doClusterLog)
Parameters:
doClusterLog - The doClusterLog to set.

getLogger

public org.apache.commons.logging.Log getLogger()
Description copied from interface: CatalinaCluster
Returns the associates logger with this cluster.

Specified by:
getLogger in interface CatalinaCluster
Returns:
Log

getClusterLog

public org.apache.commons.logging.Log getClusterLog()

logReceiveMessage

protected void logReceiveMessage(ClusterMessage message,
                                 long start,
                                 boolean accepted)
log received message to cluster transfer log

Parameters:
message -
start -
accepted -

logSendMessage

protected void logSendMessage(ClusterMessage message,
                              long start,
                              Member dest)
log sended message to cluster transfer log

Parameters:
message -
start -
dest -

registerMBeans

protected void registerMBeans()
register Means at cluster.


unregisterMBeans

protected void unregisterMBeans()

getMBeanServer

public javax.management.MBeanServer getMBeanServer()
                                            throws java.lang.Exception
Get current Catalina MBean Server and load mbean registry

Returns:
The server
Throws:
java.lang.Exception

getManagedBean

public javax.management.modelmbean.ModelMBean getManagedBean(java.lang.Object object)
                                                      throws java.lang.Exception
Returns the ModelMBean

Parameters:
object - The Object to get the ModelMBean for
Returns:
The ModelMBean
Throws:
java.lang.Exception - If an error occurs this constructors throws this exception

setObjectName

public void setObjectName(javax.management.ObjectName name)

getObjectName

public javax.management.ObjectName getObjectName()

setProtocol

public void setProtocol(java.lang.String protocol)
Description copied from interface: Cluster
Set the protocol parameters.

Specified by:
setProtocol in interface Cluster
Parameters:
protocol - The protocol used by the cluster
See Also:
Cluster.setProtocol(java.lang.String)

getProtocol

public java.lang.String getProtocol()
Description copied from interface: Cluster
Get the protocol used by the cluster.

Specified by:
getProtocol in interface Cluster
Returns:
The protocol
See Also:
Cluster.getProtocol()

startContext

public void startContext(java.lang.String contextPath)
                  throws java.io.IOException
Description copied from interface: Cluster
Start an existing web application, attached to the specified context path in all the other nodes in the cluster. Only starts a web application if it is not running.

Specified by:
startContext in interface Cluster
Parameters:
contextPath - The context path of the application to be started
Throws:
java.io.IOException - if an input/output error occurs during startup
See Also:
Cluster.startContext(java.lang.String)

installContext

public void installContext(java.lang.String contextPath,
                           java.net.URL war)
Description copied from interface: Cluster
Install a new web application, whose web application archive is at the specified URL, into this container with the specified context path. A context path of "" (the empty string) should be used for the root application for this container. Otherwise, the context path must start with a slash.

If this application is successfully installed, a ContainerEvent of type PRE_INSTALL_EVENT will be sent to registered listeners before the associated Context is started, and a ContainerEvent of type INSTALL_EVENT will be sent to all registered listeners after the associated Context is started, with the newly created Context as an argument.

Specified by:
installContext in interface Cluster
Parameters:
contextPath - The context path to which this application should be installed (must be unique)
war - A URL of type "jar:" that points to a WAR file, or type "file:" that points to an unpacked directory structure containing the web application to be installed
See Also:
Cluster.installContext(java.lang.String, java.net.URL)

stop

public void stop(java.lang.String contextPath)
          throws java.io.IOException
Description copied from interface: Cluster
Stop an existing web application, attached to the specified context path. Only stops a web application if it is running.

Specified by:
stop in interface Cluster
Parameters:
contextPath - The context path of the application to be stopped
Throws:
java.io.IOException - if an input/output error occurs while stopping the web application
See Also:
Cluster.stop(java.lang.String)


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