Author: rjung
Date: Wed Mar 26 04:33:05 2008
New Revision: 641265

URL: http://svn.apache.org/viewvc?rev=641265&view=rev
Log:
Implement Cluster interface changes in TC 6:
  - new registerManager()
  - new removeManager()

Modified:
    
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java

Modified: 
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
URL: 
http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java?rev=641265&r1=641264&r2=641265&view=diff
==============================================================================
--- 
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
 (original)
+++ 
tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
 Wed Mar 26 04:33:05 2008
@@ -552,16 +552,6 @@
             } catch (Exception x) {
                 log.error("Unable to load class for replication manager", x);
                 manager = new 
org.apache.catalina.cluster.session.DeltaManager();
-            } finally {
-                if (manager != null) {
-                    manager.setDistributable(true);
-                    if (manager instanceof ClusterManager) {
-                        ClusterManager cmanager = (ClusterManager) manager;
-                        cmanager.setDefaultMode(true);
-                        cmanager.setName(getManagerName(name, manager));
-                        cmanager.setCluster(this);
-                    }
-                }
             }
         }finally {
             Thread.currentThread().setContextClassLoader(oldCtxLoader);
@@ -569,6 +559,28 @@
         return manager;
     }
 
+    public void registerManager(Manager manager) {
+
+        if (! (manager instanceof ClusterManager)) {
+            log.warn("Manager [ " + manager + "] does not implement 
ClusterManager, addition to cluster has been aborted.");
+            return;
+        }
+        ClusterManager cmanager = (ClusterManager) manager ;
+        cmanager.setDistributable(true);
+        // Notify our interested LifecycleListeners
+        lifecycle.fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
+        String clusterName = getManagerName(cmanager.getName(), manager);
+        cmanager.setName(clusterName);
+        cmanager.setCluster(this);
+// XXX: TC6 cluster has: cmanager.setDefaultMode(false);
+// XXX: Find out, which one is correct/better.
+        cmanager.setDefaultMode(true);
+
+        managers.put(clusterName, manager);
+        // Notify our interested LifecycleListeners
+        lifecycle.fireLifecycleEvent(AFTER_MANAGERREGISTER_EVENT, manager);
+    }
+
     /**
      * remove an application form cluster replication bus
      * 
@@ -585,6 +597,19 @@
             // Notify our interested LifecycleListeners
             lifecycle
                     .fireLifecycleEvent(AFTER_MANAGERUNREGISTER_EVENT, 
manager);
+        }
+    }
+
+    /**
+     * remove an application form cluster replication bus
+     *
+     * @see 
org.apache.catalina.ha.CatalinaCluster#removeManager(java.lang.String,Manager)
+     */
+    public void removeManager(Manager manager) {
+        if (manager != null && manager instanceof ClusterManager ) {
+            ClusterManager cmgr = (ClusterManager) manager;
+            String name = cmgr.getName();
+            removeManager(name, manager);
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to