## org.apache.catalina.cluster
Class StandardCluster

    java.lang.Object
      org.apache.catalina.cluster.StandardCluster

All Implemented Interfaces:
  Cluster, Lifecycle, java.lang.Runnable

public final class StandardCluster
extends java.lang.Object
implements Cluster, Lifecycle, java.lang.Runnable

A Cluster implementation. Responsible for setting up a cluster and provides callers with a valid multicast receiver/sender.

Version:
  $Revision: 466595 $, $Date: 2006-10-21 23:24:41 +0100 (Sat, 21 Oct 2006) $
Author:
  Bip Thelin

Field Summary

Fields inherited from interface org.apache.catalina.Lifecycle
`AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT`

Constructor Summary
`StandardCluster()`

Method Summary
`void` `addLifecycleListener(LifecycleListener listener)` Add a lifecycle event listener to this component.
`LifecycleListener[]` `findLifecycleListeners()` Get the lifecycle listeners associated with this lifecycle.
`int` `getCheckInterval()` Get the time in seconds this Cluster sleeps
`java.lang.String` `getClusterName()` Return the name of the cluster that this Server is currently configured to operate within.
`ClusterReceiver` `getClusterReceiver(java.lang.String senderId)` Returns a `ClusterReceiver` which is the interface to use when receiving information in the Cluster.
`ClusterSender` `getClusterSender(java.lang.String senderId)` Returns a `ClusterSender` which is the interface to use when sending information in the Cluster.
`Container` `getContainer()` Get the Container associated with our Cluster
`int` `getDebug()` Get the debug level for this component
`java.lang.String` `getInfo()` Return descriptive information about this Cluster implementation and the corresponding version number, in the format `<description>/<version>`.
`ClusterMemberInfo` `getLocalClusterMember()` Return cluster information about the local host
`java.net.InetAddress` `getMulticastAddress()` Get the Groupaddress associated with our Cluster
`int` `getMulticastPort()` Get the Port associated with our Cluster
`protected java.lang.String` `getName()` Return a `String` containing the name of this Cluster implementation, used for logging
`ClusterMemberInfo[]` `getRemoteClusterMembers()` Returns a collection containing `ClusterMemberInfo` on the remote members of this Cluster.
`protected void` `log(java.lang.String message)` Log a message on the Logger associated with our Container (if any).
`void` `removeLifecycleListener(LifecycleListener listener)` Remove a lifecycle event listener from this component.
`void` `run()` The background thread.
`void` `setCheckInterval(int checkInterval)` Set the time in seconds for this component to Sleep before it checks for new received data in the Cluster
`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` `setContainer(Container container)` Set the Container associated with our Cluster
`void` `setDebug(int debug)` Set the debug level for this component
`void` `setMulticastAddress(java.lang.String multicastAddress)` Set the Groupaddress associated with our Cluster
`void` `setMulticastPort(int multicastPort)` Set the Port associated with our Cluster
`void` `start()` Prepare for the beginning of active use of the public methods of this component.
`void` `stop()` Gracefully terminate the active use of the public methods of this component.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StandardCluster

    public StandardCluster()

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`

### getName

    protected java.lang.String getName()

  Return a `String` containing the name of this Cluster implementation, used for logging

  Returns:
    The Cluster implementation

### setDebug

    public void setDebug(int debug)

  Set the debug level for this component

  Specified by:
    `setDebug` in interface `Cluster`
  Parameters:
    `debug` - The debug level

### getDebug

    public int getDebug()

  Get the debug level for this component

  Specified by:
    `getDebug` in interface `Cluster`
  Returns:
    The debug level

### 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

### setMulticastPort

    public void setMulticastPort(int multicastPort)

  Set the Port associated with our Cluster

  Parameters:
    `multicastPort` - The Port to use

### getMulticastPort

    public int getMulticastPort()

  Get the Port associated with our Cluster

  Returns:
    The Port associated with our Cluster

### setMulticastAddress

    public void setMulticastAddress(java.lang.String multicastAddress)

  Set the Groupaddress associated with our Cluster

  Parameters:
    `multicastAddress` - The Groupaddress to use

### getMulticastAddress

    public java.net.InetAddress getMulticastAddress()

  Get the Groupaddress associated with our Cluster

  Returns:
    The Groupaddress associated with our Cluster

### setCheckInterval

    public void setCheckInterval(int checkInterval)

  Set the time in seconds for this component to Sleep before it checks for new received data in the Cluster

  Specified by:
    `setCheckInterval` in interface `Cluster`
  Parameters:
    `checkInterval` - The time to sleep

### getCheckInterval

    public int getCheckInterval()

  Get the time in seconds this Cluster sleeps

  Specified by:
    `getCheckInterval` in interface `Cluster`
  Returns:
    The time in seconds this Cluster sleeps

### getRemoteClusterMembers

    public ClusterMemberInfo[] getRemoteClusterMembers()

  Returns a collection containing `ClusterMemberInfo` on the remote members of this Cluster. This method does not include the local host, to retrieve `ClusterMemberInfo` on the local host use `getLocalClusterInfo()` instead.

  Specified by:
    `getRemoteClusterMembers` in interface `Cluster`
  Returns:
    Collection with all members in the Cluster

### getLocalClusterMember

    public ClusterMemberInfo getLocalClusterMember()

  Return cluster information about the local host

  Specified by:
    `getLocalClusterMember` in interface `Cluster`
  Returns:
    Cluster information

### getClusterSender

    public ClusterSender getClusterSender(java.lang.String senderId)

  Returns a `ClusterSender` which is the interface to use when sending information in the Cluster. senderId is used as a identifier so that information sent through this instance can only be used with the respectice `ClusterReceiver`

  Specified by:
    `getClusterSender` in interface `Cluster`
  Returns:
    The ClusterSender

### getClusterReceiver

    public ClusterReceiver getClusterReceiver(java.lang.String senderId)

  Returns a `ClusterReceiver` which is the interface to use when receiving information in the Cluster. senderId is used as a indentifier, only information send through the `ClusterSender` with the same senderId can be received.

  Specified by:
    `getClusterReceiver` in interface `Cluster`
  Returns:
    The ClusterReceiver

### log

    protected void log(java.lang.String message)

  Log a message on the Logger associated with our Container (if any).

  Parameters:
    `message` - Message to be logged

### 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

### 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.

  Specified by:
    `start` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if this component detects a fatal error that prevents this component from being used

### stop

    public void stop()
              throws LifecycleException

  Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.

  Specified by:
    `stop` in interface `Lifecycle`
  Throws:
    `LifecycleException` - if this component detects a fatal error that needs to be reported

### run

    public void run()

  The background thread.

  Specified by:
    `run` in interface `java.lang.Runnable`

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