You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2009/05/26 07:10:59 UTC

svn commit: r778560 - in /ofbiz/trunk/framework: base/config/ofbiz-containers.xml catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java

Author: jacopoc
Date: Tue May 26 05:10:57 2009
New Revision: 778560

URL: http://svn.apache.org/viewvc?rev=778560&view=rev
Log:
Misc fixes and enhancements to the Catalina cluster support.
Patch from Scott Gray and me, based and bug reports and tests from Sam Hamilton and Nico Toerl.

Modified:
    ofbiz/trunk/framework/base/config/ofbiz-containers.xml
    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java

Modified: ofbiz/trunk/framework/base/config/ofbiz-containers.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/config/ofbiz-containers.xml?rev=778560&r1=778559&r2=778560&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/config/ofbiz-containers.xml (original)
+++ ofbiz/trunk/framework/base/config/ofbiz-containers.xml Tue May 26 05:10:57 2009
@@ -121,7 +121,7 @@
                 <property name="rep-valve-filter">
                     <property-value>.*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;</property-value>
                 </property>
-                <property name="manager-class" value="org.apache.catalina.cluster.session.DeltaManager"/>
+                <property name="manager-class" value="org.apache.catalina.ha.session.DeltaManager"/>
                 <property name="debug" value="5"/>
                 <property name="replication-mode" value="org.apache.catalina.tribes.transport.bio.PooledMultiSender"/>
                 <property name="tcp-listen-host" value="auto"/>
@@ -129,7 +129,7 @@
                 <property name="tcp-sector-timeout" value="100"/>
                 <property name="tcp-thread-count" value="6"/>
                 <property name="mcast-bind-addr" value="192.168.2.1"/>
-                <property name="mcast-addr" value="224.0.0.1"/>
+                <property name="mcast-addr" value="228.0.0.4"/>
                 <property name="mcast-port" value="45564"/>
                 <property name="mcast-freq" value="500"/>
                 <property name="mcast-drop-time" value="3000"/>

Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=778560&r1=778559&r2=778560&view=diff
==============================================================================
--- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
+++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Tue May 26 05:10:57 2009
@@ -34,6 +34,7 @@
 import org.ofbiz.base.container.Container;
 import org.ofbiz.base.container.ContainerConfig;
 import org.ofbiz.base.container.ContainerException;
+import org.ofbiz.base.container.ContainerConfig.Container.Property;
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.GenericDelegator;
 
@@ -422,14 +423,23 @@
         } catch (Exception exc) {
             throw new ContainerException("Cluster configuration requires a valid replication-mode property: " + exc.getMessage());
         }
-        String mgrClassName = ContainerConfig.getPropertyValue(clusterProps, "manager-class", "org.apache.catalina.cluster.session.DeltaManager");
+        String mgrClassName = ContainerConfig.getPropertyValue(clusterProps, "manager-class", "org.apache.catalina.ha.session.DeltaManager");
         //int debug = ContainerConfig.getPropertyValue(clusterProps, "debug", 0);
         // removed since 5.5.9? boolean expireSession = ContainerConfig.getPropertyValue(clusterProps, "expire-session", false);
         // removed since 5.5.9? boolean useDirty = ContainerConfig.getPropertyValue(clusterProps, "use-dirty", true);
 
         SimpleTcpCluster cluster = new SimpleTcpCluster();
         cluster.setClusterName(clusterProps.name);
-        cluster.setManagerClassName(mgrClassName);
+        Manager manager = null;
+        try {
+            manager = (Manager)Class.forName(mgrClassName).newInstance();
+        } catch(Exception exc) {
+            throw new ContainerException("Cluster configuration requires a valid manager-class property: " + exc.getMessage());
+        }
+        //cluster.setManagerClassName(mgrClassName);
+        //host.setManager(manager);
+        //cluster.registerManager(manager);
+        cluster.setManagerTemplate((org.apache.catalina.ha.ClusterManager)manager);
         //cluster.setDebug(debug);
         // removed since 5.5.9? cluster.setExpireSessionsOnShutdown(expireSession);
         // removed since 5.5.9? cluster.setUseDirtyFlag(useDirty);
@@ -510,8 +520,20 @@
         }
 
         // configure persistent sessions
-        Manager sessionMgr = new StandardManager();
+        Property clusterProp = clusterConfig.get(engine.getName());
 
+        Manager sessionMgr = null;
+        if (clusterProp != null) {
+            String mgrClassName = ContainerConfig.getPropertyValue(clusterProp, "manager-class", "org.apache.catalina.ha.session.DeltaManager");
+            try {
+                sessionMgr = (Manager)Class.forName(mgrClassName).newInstance();
+            } catch(Exception exc) {
+                throw new ContainerException("Cluster configuration requires a valid manager-class property: " + exc.getMessage());
+            }
+        } else {
+            sessionMgr = new StandardManager();
+        }
+        
         // create the web application context
         StandardContext context = (StandardContext) embedded.createContext(mount, location);
         context.setJ2EEApplication(J2EE_APP);