You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2001/05/07 04:15:40 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session DistributedManager.java

bip         01/05/06 19:15:40

  Modified:    catalina/src/share/org/apache/catalina Cluster.java
               catalina/src/share/org/apache/catalina/session
                        DistributedManager.java
  Log:
  Cleanup in the Cluster interface to support pluggable Cluster implementations.
  Changed DistributedManager to support this new change.
  
  Revision  Changes    Path
  1.2       +54 -16    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Cluster.java
  
  Index: Cluster.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Cluster.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Cluster.java	2001/05/04 20:45:35	1.1
  +++ Cluster.java	2001/05/07 02:15:39	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Cluster.java,v 1.1 2001/05/04 20:45:35 bip Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/05/04 20:45:35 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Cluster.java,v 1.2 2001/05/07 02:15:39 bip Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/05/07 02:15:39 $
    *
    * ====================================================================
    *
  @@ -67,16 +67,20 @@
   import java.beans.PropertyChangeListener;
   import java.util.Collection;
   import org.apache.catalina.cluster.ClusterMemberInfo;
  -import org.apache.catalina.cluster.MulticastReceiver;
  -import org.apache.catalina.cluster.MulticastSender;
  +import org.apache.catalina.cluster.ClusterReceiver;
  +import org.apache.catalina.cluster.ClusterSender;
   
   /**
    * A <b>Cluster</b> works as a Cluster client/server for the local host
  - * Different Cluster implementations can be used to support Session replication
  - * or weighted loadbalancing.
  + * Different Cluster implementations can be used to support different
  + * ways to communicate within the Cluster. A Cluster implementation is
  + * responsible for setting up a way to communicate within the Cluster
  + * and also supply "ClientApplications" with <code>ClusterSender</code>
  + * used when sending information in the Cluster and
  + * <code>ClusterInfo</code> used for receiving information in the Cluster.
    *
    * @author Bip Thelin
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $, $Date: 2001/05/07 02:15:39 $
    */
   
   public interface Cluster {
  @@ -99,6 +103,21 @@
       public String getClusterName();
   
       /**
  +     * Set the time in seconds that the Cluster waits before
  +     * checking for changes and replicated data.
  +     *
  +     * @param checkInterval The time in seconds to sleep
  +     */
  +    public void setCheckInterval(int checkInterval);
  +
  +    /**
  +     * Get the time in seconds that this Cluster sleeps.
  +     *
  +     * @return The value in seconds
  +     */
  +    public int getCheckInterval();
  +
  +    /**
        * Set the name of the cluster to join, if no cluster with
        * this name is present create one.
        *
  @@ -120,6 +139,20 @@
        */
       public Container getContainer();
   
  +    /**
  +     * The debug detail level for this Cluster
  +     *
  +     * @param debug The debug level
  +     */
  +    public void setDebug(int debug);
  +
  +    /**
  +     * Returns the debug level for this Cluster
  +     *
  +     * @return The debug level
  +     */
  +    public int getDebug();
  +
       // --------------------------------------------------------- Public Methods
   
       /**
  @@ -134,20 +167,25 @@
       public Collection getRemoteClusterMembers();
   
       /**
  -     * Returns a <code>MulticastSender</code> which is the interface
  -     * to use when communicating in the Cluster. 
  +     * Returns a <code>ClusterSender</code> 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
  +     * <code>ClusterReceiver</code>
        *
  -     * @return The MulticastSender to use
  +     * @return The ClusterSender
        */
  -    public MulticastSender getMulticastSender(String senderId);
  +    public ClusterSender getClusterSender(String senderId);
   
       /**
  -     * Returns a <code>MulticastReceiver</code> which is the interface
  -     * to use when communicating in the Cluster. 
  +     * Returns a <code>ClusterReceiver</code> which is the interface
  +     * to use when receiving information in the Cluster. senderId is
  +     * used as a indentifier, only information send through the
  +     * <code>ClusterSender</code> with the same senderId can be received.
        *
  -     * @return The MulticastSender to use
  +     * @return The ClusterReceiver
        */
  -    public MulticastReceiver getMulticastReceiver(String senderId);
  +    public ClusterReceiver getClusterReceiver(String senderId);
   
       /**
        * Return cluster information about the local host
  
  
  
  1.2       +16 -16    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/DistributedManager.java
  
  Index: DistributedManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/DistributedManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DistributedManager.java	2001/05/04 20:45:47	1.1
  +++ DistributedManager.java	2001/05/07 02:15:39	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/DistributedManager.java,v 1.1 2001/05/04 20:45:47 bip Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/05/04 20:45:47 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/DistributedManager.java,v 1.2 2001/05/07 02:15:39 bip Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/05/07 02:15:39 $
    *
    * ====================================================================
    *
  @@ -79,8 +79,8 @@
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.Loader;
   import org.apache.catalina.Session;
  -import org.apache.catalina.cluster.MulticastSender;
  -import org.apache.catalina.cluster.MulticastReceiver;
  +import org.apache.catalina.cluster.ClusterSender;
  +import org.apache.catalina.cluster.ClusterReceiver;
   import org.apache.catalina.cluster.ReplicationWrapper;
   import org.apache.catalina.util.CustomObjectInputStream;
   
  @@ -90,7 +90,7 @@
    * Store to make Sessions persistence.
    *
    * @author Bip Thelin
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $, $Date: 2001/05/07 02:15:39 $
    */
   
   public final class DistributedManager extends PersistentManagerBase {
  @@ -110,14 +110,14 @@
       protected static String name = "DistributedManager";
   
       /**
  -     * Our MulticastSender, used when replicating sessions
  +     * Our ClusterSender, used when replicating sessions
        */
  -    private MulticastSender multicastSender = null;
  +    private ClusterSender clusterSender = null;
   
       /**
  -     * Our MulticastReceiver
  +     * Our ClusterReceiver
        */
  -    private MulticastReceiver multicastReceiver = null;
  +    private ClusterReceiver clusterReceiver = null;
   
   
       // ------------------------------------------------------------- Properties
  @@ -162,7 +162,7 @@
               oos.close();
               
               byte[] obs = bos.toByteArray();
  -            multicastSender.send(obs);
  +            clusterSender.send(obs);
   
               if(debug > 0)
                   log("Replicating Session: "+session.getId());
  @@ -186,8 +186,8 @@
               cluster = container.getCluster();
   
           if(cluster != null) {
  -            this.multicastSender = cluster.getMulticastSender(name);
  -            this.multicastReceiver = cluster.getMulticastReceiver(name);
  +            this.clusterSender = cluster.getClusterSender(name);
  +            this.clusterReceiver = cluster.getClusterReceiver(name);
           }
   
           super.start();
  @@ -197,8 +197,8 @@
        * Called from our background thread to process new received Sessions
        *
        */
  -    public void processMulticastReceiver() {
  -        Object[] objs = multicastReceiver.getObjects();
  +    public void processClusterReceiver() {
  +        Object[] objs = clusterReceiver.getObjects();
           StandardSession _session = null;
           ByteArrayInputStream bis = null;
           Loader loader = null;
  @@ -258,7 +258,7 @@
           // Loop until the termination semaphore is set
           while (!threadDone) {
               threadSleep();
  -            processMulticastReceiver();
  +            processClusterReceiver();
               processExpires();
               processPersistenceChecks();
           }