Save This Page
Home » apache-tomcat-6.0.26-src » org.apache » catalina » ha » tcp » [javadoc | source]
org.apache.catalina.ha.tcp
public class: SimpleTcpCluster [javadoc | source]
java.lang.Object
   org.apache.catalina.ha.tcp.SimpleTcpCluster

All Implemented Interfaces:
    IDynamicProperty, CatalinaCluster, LifecycleListener, ChannelListener, MembershipListener, Lifecycle

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
Field Summary
public static  Log log     
protected static final  String info    Descriptive information about this component implementation. 
public static final  String BEFORE_MEMBERREGISTER_EVENT     
public static final  String AFTER_MEMBERREGISTER_EVENT     
public static final  String BEFORE_MANAGERREGISTER_EVENT     
public static final  String AFTER_MANAGERREGISTER_EVENT     
public static final  String BEFORE_MANAGERUNREGISTER_EVENT     
public static final  String AFTER_MANAGERUNREGISTER_EVENT     
public static final  String BEFORE_MEMBERUNREGISTER_EVENT     
public static final  String AFTER_MEMBERUNREGISTER_EVENT     
public static final  String SEND_MESSAGE_FAILURE_EVENT     
public static final  String RECEIVE_MESSAGE_FAILURE_EVENT     
protected  Channel channel    Group channel. 
protected  String clusterImpName    Name for logging purpose 
protected  StringManager sm    The string manager for this package. 
protected  String clusterName    The cluster name to join 
protected  boolean heartbeatBackgroundEnabled    call Channel.heartbeat() at container background thread
    Also see:
    org.apache.catalina.tribes.group.GroupChannel#heartbeat()
 
protected  Container container    The Container associated with this Cluster. 
protected  LifecycleSupport lifecycle    The lifecycle event support for this component. 
protected  boolean started    Has this component been started? 
protected  PropertyChangeSupport support    The property change support for this component. 
protected  Map managers    The context name <->manager association for distributed contexts. 
protected  ClusterManager managerTemplate     
protected  List clusterListeners    Listeners of messages 
protected  boolean hasMembers    has members 
Constructor:
 public SimpleTcpCluster() 
Method from org.apache.catalina.ha.tcp.SimpleTcpCluster Summary:
accept,   addClusterListener,   addLifecycleListener,   addValve,   backgroundProcess,   checkDefaults,   createManager,   findClusterListeners,   findLifecycleListeners,   getChannel,   getChannelSendOptions,   getChannelStartOptions,   getClusterDeployer,   getClusterName,   getContainer,   getInfo,   getLocalMember,   getLogger,   getManager,   getManagerClassName,   getManagerName,   getManagerTemplate,   getManagers,   getMembers,   getProperty,   getPropertyNames,   getProtocol,   getValves,   hasMembers,   isHeartbeatBackgroundEnabled,   isNotifyLifecycleListenerOnFailure,   lifecycleEvent,   memberAdded,   memberDisappeared,   messageReceived,   messageReceived,   registerClusterValve,   registerManager,   removeClusterListener,   removeLifecycleListener,   removeManager,   removeProperty,   send,   send,   sendClusterDomain,   setChannel,   setChannelSendOptions,   setChannelStartOptions,   setClusterDeployer,   setClusterName,   setContainer,   setHeartbeatBackgroundEnabled,   setManagerClassName,   setManagerTemplate,   setNotifyLifecycleListenerOnFailure,   setProperty,   setProperty,   setProtocol,   start,   stop,   transferProperty,   unregisterClusterValve
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.ha.tcp.SimpleTcpCluster Detail:
 public boolean accept(Serializable msg,
    Member sender) 
    notify all listeners from receiving a new message is not ClusterMessage emitt Failure Event to LifecylceListener
 public  void addClusterListener(ClusterListener listener) 
    add cluster message listener and register cluster to this listener
 public  void addLifecycleListener(LifecycleListener listener) 
    Add a lifecycle event listener to this component.
 public  void addValve(Valve valve) 
    Add cluster valve Cluster Valves are only add to container when cluster is started!
 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.
 protected  void checkDefaults() 
 public synchronized Manager createManager(String name) 
    Create new Manager without add to cluster (comes with start the manager)
 public ClusterListener[] findClusterListeners() 
    Get the cluster listeners associated with this cluster. If this Array has no listeners registered, a zero-length array is returned.
 public LifecycleListener[] findLifecycleListeners() 
    Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.
 public Channel getChannel() 
 public int getChannelSendOptions() 
 public int getChannelStartOptions() 
 public ClusterDeployer getClusterDeployer() 
    get current Deployer
 public String getClusterName() 
    Return the name of the cluster that this Server is currently configured to operate within.
 public Container getContainer() 
    Get the Container associated with our Cluster
 public String getInfo() 
    Return descriptive information about this Cluster implementation and the corresponding version number, in the format <description>/<version>.
 public Member getLocalMember() 
    Return the member that represents this node.
 public Log getLogger() 
 public Manager getManager(String name) 
 public String getManagerClassName() 
Deprecated! use - getManagerTemplate().getClass().getName() instead.

 public String getManagerName(String name,
    Manager manager) 
 public ClusterManager getManagerTemplate() 
 public Map getManagers() 
 public Member[] getMembers() 
    Get all current cluster members
 public Object getProperty(String key) 
    get current config
 public Iterator getPropertyNames() 
    Get all properties keys
 public String getProtocol() 
 public Valve[] getValves() 
    get all cluster valves
 public boolean hasMembers() 
 public boolean isHeartbeatBackgroundEnabled() 
    Return heartbeat enable flag (default false)
 public boolean isNotifyLifecycleListenerOnFailure() 
 public  void lifecycleEvent(LifecycleEvent lifecycleEvent) 
    Use as base to handle start/stop/periodic Events from host. Currently only log the messages as trace level.
 public  void memberAdded(Member member) 
    New cluster member is registered
 public  void memberDisappeared(Member member) 
    Cluster member is gone
 public  void messageReceived(ClusterMessage message) 
 public  void messageReceived(Serializable message,
    Member sender) 
 protected  void registerClusterValve() throws Exception 
    register all cluster valve to host or engine
 public  void registerManager(Manager manager) 
 public  void removeClusterListener(ClusterListener listener) 
    remove message listener and deregister Cluster from listener
 public  void removeLifecycleListener(LifecycleListener listener) 
    Remove a lifecycle event listener from this component.
 public  void removeManager(Manager manager) 
    remove an application form cluster replication bus
 public  void removeProperty(String key) 
    remove a configured property.
 public  void send(ClusterMessage msg) 
    send message to all cluster members
 public  void send(ClusterMessage msg,
    Member dest) 
    send a cluster message to one member
 public  void sendClusterDomain(ClusterMessage msg) 
    send message to all cluster members same cluster domain
 public  void setChannel(Channel channel) 
 public  void setChannelSendOptions(int channelSendOptions) 
 public  void setChannelStartOptions(int channelStartOptions) 
 public  void setClusterDeployer(ClusterDeployer clusterDeployer) 
    set a new Deployer, must be set before cluster started!
 public  void setClusterName(String clusterName) 
    Set the name of the cluster to join, if no cluster with this name is present create one.
 public  void setContainer(Container container) 
    Set the Container associated with our Cluster
 public  void setHeartbeatBackgroundEnabled(boolean heartbeatBackgroundEnabled) 
    enabled that container backgroundThread call heartbeat at channel
 public  void setManagerClassName(String managerClassName) 
Deprecated! use - nested <Manager> element inside the cluster config instead.

 public  void setManagerTemplate(ClusterManager managerTemplate) 
 public  void setNotifyLifecycleListenerOnFailure(boolean notifyListenerOnFailure) 
 public boolean setProperty(String name,
    String value) 
    JMX hack to direct use at jconsole
 public boolean setProperty(String name,
    Object value) 
    set config attributes with reflect and propagate to all managers
 public  void setProtocol(String protocol) 
 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.
 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.
 protected  void transferProperty(String prefix,
    Object bean) 
    transfer properties from cluster configuration to subelement bean.
 protected  void unregisterClusterValve() throws Exception 
    unregister all cluster valve to host or engine