geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r475692 - in /geronimo/server/trunk: ./ configs/wadi-clustering/ configs/wadi-clustering/src/plan/ modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/ modules/geronimo-jetty-clustering-wadi/src/main/java/org/...
Date Thu, 16 Nov 2006 11:47:05 GMT
Author: gdamour
Date: Thu Nov 16 03:47:04 2006
New Revision: 475692

URL: http://svn.apache.org/viewvc?view=rev&rev=475692
Log:
* GERONIMO-2470 - Add support for Session Replication
* Move to WADI release version 2.0M2.


Modified:
    geronimo/server/trunk/configs/wadi-clustering/pom.xml
    geronimo/server/trunk/configs/wadi-clustering/src/plan/plan.xml
    geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
    geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
    geronimo/server/trunk/modules/geronimo-jetty-clustering-wadi/src/main/java/org/apache/geronimo/jetty/cluster/wadi/WADIClusteredHandleInterceptor.java
    geronimo/server/trunk/pom.xml

Modified: geronimo/server/trunk/configs/wadi-clustering/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/wadi-clustering/pom.xml?view=diff&rev=475692&r1=475691&r2=475692
==============================================================================
--- geronimo/server/trunk/configs/wadi-clustering/pom.xml (original)
+++ geronimo/server/trunk/configs/wadi-clustering/pom.xml Thu Nov 16 03:47:04 2006
@@ -37,6 +37,7 @@
         <PlanDefaultSweepInterval>36000</PlanDefaultSweepInterval>
         <PlanDefaultNumPartitions>24</PlanDefaultNumPartitions>
         <PlanNbReplica>2</PlanNbReplica>
+        <EndPointURI>http://localhost:8080</EndPointURI>
         <PlanClusterName>DEFAULT_CLUSTER</PlanClusterName>
         <PlanInactiveTime>3600</PlanInactiveTime>
     </properties>

Modified: geronimo/server/trunk/configs/wadi-clustering/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/wadi-clustering/src/plan/plan.xml?view=diff&rev=475692&r1=475691&r2=475692
==============================================================================
--- geronimo/server/trunk/configs/wadi-clustering/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/wadi-clustering/src/plan/plan.xml Thu Nov 16 03:47:04 2006
@@ -30,6 +30,7 @@
     </gbean>
 
     <gbean name="DefaultDispatcherHolder" class="org.apache.geronimo.clustering.wadi.TribesDispatcherHolder">
+        <attribute name="endPointURI">${EndPointURI}</attribute>
         <attribute name="clusterName">${PlanClusterName}</attribute>
         <attribute name="inactiveTime">${PlanInactiveTime}</attribute>
         <reference name="Node">

Modified: geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java?view=diff&rev=475692&r1=475691&r2=475692
==============================================================================
--- geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
(original)
+++ geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/BasicWADISessionManager.java
Thu Nov 16 03:47:04 2006
@@ -19,10 +19,8 @@
 
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 import java.util.regex.Pattern;
 
 import javax.servlet.ServletContext;
@@ -56,11 +54,9 @@
 import org.codehaus.wadi.impl.ClusterContextualiser;
 import org.codehaus.wadi.impl.ClusteredManager;
 import org.codehaus.wadi.impl.DummyContextualiser;
-import org.codehaus.wadi.impl.DummyReplicaterFactory;
 import org.codehaus.wadi.impl.HashingCollapser;
 import org.codehaus.wadi.impl.HybridRelocater;
 import org.codehaus.wadi.impl.MemoryContextualiser;
-import org.codehaus.wadi.impl.SerialContextualiser;
 import org.codehaus.wadi.impl.SerialContextualiserFrontingMemory;
 import org.codehaus.wadi.impl.SimpleSessionPool;
 import org.codehaus.wadi.impl.SimpleStreamer;
@@ -84,10 +80,12 @@
 import org.codehaus.wadi.web.impl.DistributableValueFactory;
 import org.codehaus.wadi.web.impl.DummyRouter;
 import org.codehaus.wadi.web.impl.DummyStatefulHttpServletRequestWrapperPool;
+import org.codehaus.wadi.web.impl.StandardHttpProxy;
 import org.codehaus.wadi.web.impl.StandardSessionWrapperFactory;
 import org.codehaus.wadi.web.impl.WebSessionToSessionPoolAdapter;
 
 import EDU.oswego.cs.dl.util.concurrent.Sync;
+import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList;
 
 /**
  * 
@@ -101,28 +99,29 @@
     private final ReplicaStorageFactory repStorageFactory;
     private final BackingStrategyFactory backingStrategyFactory;
     private final DispatcherHolder dispatcherHolder;
-    private final Set listeners;
+    private final CopyOnWriteArrayList listeners;
 
     private ClusteredManager manager;
     private BasicServiceSpace serviceSpace;
 
     public BasicWADISessionManager(WADISessionManagerConfigInfo configInfo,
-            ReplicationManagerFactory repManagerFactory, ReplicaStorageFactory repStorageFactory,
-            BackingStrategyFactory backingStrategyFactory, DispatcherHolder dispatcherHolder)
{
+            ReplicationManagerFactory repManagerFactory, 
+            ReplicaStorageFactory repStorageFactory,
+            BackingStrategyFactory backingStrategyFactory, 
+            DispatcherHolder dispatcherHolder) {
         this.configInfo = configInfo;
         this.dispatcherHolder = dispatcherHolder;
         this.repManagerFactory = repManagerFactory;
         this.repStorageFactory = repStorageFactory;
         this.backingStrategyFactory = backingStrategyFactory;
 
-        listeners = new HashSet();
+        listeners = new CopyOnWriteArrayList();
     }
 
     public void doStart() throws Exception {
         Dispatcher underlyingDisp = dispatcherHolder.getDispatcher();
 
         serviceSpace = new BasicServiceSpace(new ServiceSpaceName(configInfo.getServiceSpaceURI()),
underlyingDisp);
-        Dispatcher dispatcher = serviceSpace.getDispatcher();
 
         boolean strictOrdering = true;
         Streamer streamer = new SimpleStreamer();
@@ -134,18 +133,15 @@
         Contextualiser contextualiser = new DummyContextualiser();
 
         // replica aware contextualiser
-//         ReplicationManager replicationManager = repManagerFactory.factory(serviceSpace,
backingStrategyFactory);
-//         ReplicationManager sessionRepManager = new SessionReplicationManager(replicationManager,
sessionPool);
-//         contextualiser = new ReplicaAwareContextualiser(contextualiser, sessionRepManager);
+         ReplicationManager replicationManager = repManagerFactory.factory(serviceSpace,
backingStrategyFactory);
+         ReplicationManager sessionRepManager = new SessionReplicationManager(replicationManager,
sessionPool);
+         contextualiser = new ReplicaAwareContextualiser(contextualiser, sessionRepManager);
 
         // cluster aware contextualiser
         contextualiser = new ClusterContextualiser(contextualiser, collapser, new HybridRelocater(5000,
5000, true));
 
-        contextualiser = new StatelessContextualiser(contextualiser, Pattern.compile("GET|POST",
2), true, Pattern
-                .compile(".*\\.(JPG|JPEG|GIF|PNG|ICO|HTML|HTM)", 2), false);
-
-        // serialize invocations bound to the same session id
-        contextualiser = new SerialContextualiser(contextualiser, collapser, mmap);
+        contextualiser = new StatelessContextualiser(contextualiser, Pattern.compile("GET|POST",
2), true, 
+                Pattern.compile(".*\\.(JPG|JPEG|GIF|PNG|ICO|HTML|HTM)", 2), false);
 
         // in-memory contextualiser
         Evicter mevicter = new AbsoluteEvicter(configInfo.getSweepInterval(), strictOrdering,
@@ -154,7 +150,7 @@
         PoolableInvocationWrapperPool requestPool = new DummyStatefulHttpServletRequestWrapperPool();
         contextualiser = new MotionTracker(contextualiser, mevicter, mmap, streamer, contextPool,
requestPool);
 
-        contextualiser = new SerialContextualiserFrontingMemory(contextualiser, new HashingCollapser(1024,
10000));
+        contextualiser = new SerialContextualiserFrontingMemory(contextualiser, collapser);
 
         // Manager
         manager = new ClusteredManager(sessionPool, 
@@ -168,11 +164,9 @@
                 false, 
                 streamer, 
                 true,
-                new DummyReplicaterFactory(),
-//                new ReplicaterAdapterFactory(replicationManager, sessionPool),
-                null, 
-                null, 
-                dispatcher, 
+                new ReplicaterAdapterFactory(replicationManager, sessionPool),
+                new StandardHttpProxy("jsessionid"), 
+                serviceSpace, 
                 configInfo.getNumPartitions(), 
                 collapser);
 
@@ -186,8 +180,8 @@
         });
 
         ServiceRegistry serviceRegistry = serviceSpace.getServiceRegistry();
-//        serviceRegistry.register(ReplicaStorage.NAME, repStorageFactory.factory(serviceSpace));
-//        serviceRegistry.register(ReplicationManager.NAME, replicationManager);
+        serviceRegistry.register(ReplicaStorage.NAME, repStorageFactory.factory(serviceSpace));
+        serviceRegistry.register(ReplicationManager.NAME, replicationManager);
         serviceRegistry.register(ClusteredManager.NAME, manager);
 
         serviceSpace.start();
@@ -224,32 +218,24 @@
     }
 
     public void registerListener(SessionListener listener) {
-        synchronized (listeners) {
-            listeners.add(listener);
-        }
+        listeners.add(listener);
     }
 
     public void unregisterListener(SessionListener listener) {
-        synchronized (listeners) {
-            listeners.remove(listener);
-        }
+        listeners.remove(listener);
     }
 
     private void notifyInboundSessionMigration(WebSession webSession) {
-        synchronized (listeners) {
-            for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-                SessionListener listener = (SessionListener) iter.next();
-                listener.notifyInboundSessionMigration(new WADISessionAdaptor(webSession));
-            }
+        for (Iterator iter = listeners.iterator(); iter.hasNext();) {
+            SessionListener listener = (SessionListener) iter.next();
+            listener.notifyInboundSessionMigration(new WADISessionAdaptor(webSession));
         }
     }
 
     private WebSession notifyOutboundSessionMigration(WebSession webSession) {
-        synchronized (listeners) {
-            for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-                SessionListener listener = (SessionListener) iter.next();
-                listener.notifyOutboundSessionMigration(new WADISessionAdaptor(webSession));
-            }
+        for (Iterator iter = listeners.iterator(); iter.hasNext();) {
+            SessionListener listener = (SessionListener) iter.next();
+            listener.notifyOutboundSessionMigration(new WADISessionAdaptor(webSession));
         }
         return webSession;
     }

Modified: geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java?view=diff&rev=475692&r1=475691&r2=475692
==============================================================================
--- geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
(original)
+++ geronimo/server/trunk/modules/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
Thu Nov 16 03:47:04 2006
@@ -17,6 +17,8 @@
  */
 package org.apache.geronimo.clustering.wadi;
 
+import java.net.URI;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.clustering.Node;
@@ -27,6 +29,7 @@
 import org.codehaus.wadi.group.Dispatcher;
 import org.codehaus.wadi.group.MessageExchangeException;
 import org.codehaus.wadi.tribes.TribesDispatcher;
+import org.codehaus.wadi.web.impl.URIEndPoint;
 
 /**
  *
@@ -35,20 +38,32 @@
 public class TribesDispatcherHolder implements GBeanLifecycle, DispatcherHolder {
     private static final Log log = LogFactory.getLog(TribesDispatcherHolder.class); 
     
+    private final URI endPointURI;
     private final String clusterName;
     private final long inactiveTime;
     private final Node node;
 
     private TribesDispatcher dispatcher;
 
-    public TribesDispatcherHolder(String clusterName, long inactiveTime, Node node) {
+
+    public TribesDispatcherHolder(URI endPointURI, String clusterName, long inactiveTime,
Node node) {
+        if (null == endPointURI) {
+            throw new IllegalArgumentException("endPointURI is required");
+        } else if (null == clusterName) {
+            throw new IllegalArgumentException("clusterName is required");
+        } else if (0 > inactiveTime) {
+            throw new IllegalArgumentException("inactiveTime must be > 0");
+        } else if (null == node) {
+            throw new IllegalArgumentException("node is required");
+        }
+        this.endPointURI = endPointURI;
         this.clusterName = clusterName;
         this.inactiveTime = inactiveTime;
         this.node = node;
     }
 
     public void doStart() throws Exception {
-        dispatcher = new TribesDispatcher(clusterName, node.getName(), inactiveTime, null);
+        dispatcher = new TribesDispatcher(clusterName, node.getName(), new URIEndPoint(endPointURI),
inactiveTime, null);
         dispatcher.start();
     }
 
@@ -75,6 +90,7 @@
     
     public static final GBeanInfo GBEAN_INFO;
     
+    public static final String GBEAN_ATTR_END_POINT_URI = "endPointURI";
     public static final String GBEAN_ATTR_CLUSTER_NAME = "clusterName";
     public static final String GBEAN_ATTR_CLUSTER_URI = "clusterUri";
     public static final String GBEAN_ATTR_INACTIVE_TIME = "inactiveTime";
@@ -85,6 +101,7 @@
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(TribesDispatcherHolder.class,

                 NameFactory.GERONIMO_SERVICE);
         
+        infoBuilder.addAttribute(GBEAN_ATTR_END_POINT_URI, URI.class, true);
         infoBuilder.addAttribute(GBEAN_ATTR_CLUSTER_NAME, String.class, true);
         infoBuilder.addAttribute(GBEAN_ATTR_INACTIVE_TIME, long.class, true);
         
@@ -92,7 +109,9 @@
 
         infoBuilder.addInterface(DispatcherHolder.class);
         
-        infoBuilder.setConstructor(new String[] { GBEAN_ATTR_CLUSTER_NAME, 
+        infoBuilder.setConstructor(new String[] {
+                GBEAN_ATTR_END_POINT_URI,
+                GBEAN_ATTR_CLUSTER_NAME, 
                 GBEAN_ATTR_INACTIVE_TIME, 
                 GBEAN_REF_NODE });
         

Modified: geronimo/server/trunk/modules/geronimo-jetty-clustering-wadi/src/main/java/org/apache/geronimo/jetty/cluster/wadi/WADIClusteredHandleInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jetty-clustering-wadi/src/main/java/org/apache/geronimo/jetty/cluster/wadi/WADIClusteredHandleInterceptor.java?view=diff&rev=475692&r1=475691&r2=475692
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jetty-clustering-wadi/src/main/java/org/apache/geronimo/jetty/cluster/wadi/WADIClusteredHandleInterceptor.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jetty-clustering-wadi/src/main/java/org/apache/geronimo/jetty/cluster/wadi/WADIClusteredHandleInterceptor.java
Thu Nov 16 03:47:04 2006
@@ -34,6 +34,7 @@
 import org.apache.geronimo.jetty.HandleInterceptor;
 import org.apache.geronimo.jetty.cluster.AbstractClusteredHandleInterceptor;
 import org.codehaus.wadi.InvocationException;
+import org.codehaus.wadi.InvocationProxy;
 import org.codehaus.wadi.impl.ClusteredManager;
 import org.codehaus.wadi.web.impl.WebInvocation;
 import org.mortbay.http.HttpRequest;
@@ -83,7 +84,7 @@
             ServletHttpRequest servletHttpRequest = (ServletHttpRequest) request.getWrapper();
             ServletHttpResponse servletHttpResponse = (ServletHttpResponse) response.getWrapper();
 
-            WebInvocation invocation = WebInvocation.getThreadLocalInstance();
+            WebInvocation invocation = new WebInvocation();
             FilterChain chainAdapter = new FilterChain() {
                 public void doFilter(ServletRequest request, ServletResponse response) throws
IOException, ServletException {
                     try {
@@ -93,7 +94,8 @@
                     }
                 }
             };
-            invocation.init(servletHttpRequest, servletHttpResponse, chainAdapter);
+            InvocationProxy invocationProxy = wadiManager.getInvocationProxy();
+            invocation.init(servletHttpRequest, servletHttpResponse, chainAdapter, invocationProxy);
             try {
                 wadiManager.contextualise(invocation);
             } catch (InvocationException e) {

Modified: geronimo/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/pom.xml?view=diff&rev=475692&r1=475691&r2=475692
==============================================================================
--- geronimo/server/trunk/pom.xml (original)
+++ geronimo/server/trunk/pom.xml Thu Nov 16 03:47:04 2006
@@ -943,25 +943,25 @@
             <dependency>
                 <groupId>org.codehaus.wadi</groupId>
                 <artifactId>wadi-core</artifactId>
-                <version>2.0M2-SNAPSHOT</version>
+                <version>2.0M2</version>
             </dependency>
 
             <dependency>
                 <groupId>org.codehaus.wadi</groupId>
                 <artifactId>wadi-group</artifactId>
-                <version>2.0M2-SNAPSHOT</version>
+                <version>2.0M2</version>
             </dependency>
 
             <dependency>
                 <groupId>org.codehaus.wadi</groupId>
                 <artifactId>wadi-tribes</artifactId>
-                <version>2.0M2-SNAPSHOT</version>
+                <version>2.0M2</version>
             </dependency>
 
             <dependency>
                 <groupId>org.codehaus.wadi</groupId>
                 <artifactId>wadi-tribes</artifactId>
-                <version>2.0M2-SNAPSHOT</version>
+                <version>2.0M2</version>
             </dependency>
 
             <dependency>



Mime
View raw message