geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r689706 - in /geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src: main/java/org/apache/geronimo/openejb/cluster/stateful/container/ main/resources/META-INF/org.apache.geronimo.openejb.cluster/ test/java/org/apache/ge...
Date Thu, 28 Aug 2008 03:07:59 GMT
Author: dain
Date: Wed Aug 27 20:07:59 2008
New Revision: 689706

URL: http://svn.apache.org/viewvc?rev=689706&view=rev
Log:
Updated to latest OpenEJB APIs

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainerTest.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java?rev=689706&r1=689705&r2=689706&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainer.java
Wed Aug 27 20:07:59 2008
@@ -25,8 +25,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import javax.transaction.TransactionManager;
-
 import org.apache.geronimo.clustering.SessionManager;
 import org.apache.geronimo.clustering.wadi.WADISessionManager;
 import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorTracker;
@@ -37,9 +35,6 @@
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.core.CoreDeploymentInfo;
 import org.apache.openejb.core.stateful.StatefulContainer;
-import org.apache.openejb.core.stateful.Instance;
-import org.apache.openejb.core.stateful.Cache;
-import org.apache.openejb.core.stateful.PassivationStrategy;
 import org.apache.openejb.spi.SecurityService;
 import org.codehaus.wadi.core.contextualiser.BasicInvocation;
 import org.codehaus.wadi.core.contextualiser.InvocationContext;
@@ -52,30 +47,18 @@
  *
  * @version $Rev:$ $Date:$
  */
+// todo Consider replacing this class with an RpcContainerWrapper subclass
 public class ClusteredStatefulContainer extends StatefulContainer implements SessionManagerTracker,
ClusteredRPCContainer {
     private final Map<Object, Manager> deploymentIdToManager;
     private final Map<Object, NetworkConnectorTracker> deploymentIdToNetworkConnectorTracker;
-    
-    public ClusteredStatefulContainer(Object id,
-        TransactionManager transactionManager,
-        SecurityService securityService,
-        Class passivator,
-        int timeOut,
-        int poolSize,
-        int bulkPassivate) throws OpenEJBException {
-        super(id, securityService, passivator, timeOut, poolSize, bulkPassivate);
-        
+
+    public ClusteredStatefulContainer(Object id, SecurityService securityService) {
+        super(id, securityService, new WadiCache());
+
         deploymentIdToManager = new HashMap<Object, Manager>();
         deploymentIdToNetworkConnectorTracker = new HashMap<Object, NetworkConnectorTracker>();
     }
 
-    protected Cache<Object, Instance> createCache(Class<? extends PassivationStrategy>
passivator,
-            int timeOut,
-            int poolSize,
-            int bulkPassivate) throws OpenEJBException {
-        return new WadiCache(new StatefulCacheListener());
-    }
-
     public void addSessionManager(Object deploymentId, SessionManager sessionManager) {
         ((WadiCache) cache).addSessionManager(deploymentId, sessionManager);
         
@@ -126,7 +109,7 @@
         } catch (NetworkConnectorTrackerException e) {
             return null;
         }
-        return connectorURIs.toArray(new URI[0]);
+        return connectorURIs.toArray(new URI[connectorURIs.size()]);
     }
 
     @Override
@@ -177,13 +160,6 @@
         return super.removeEJBObject(deploymentInfo, primKey, callInterface, callMethod,
args);
     }
 
-    //
-    // TODO: THIS WILL NOT WORK
-    // OpenEJB invocations can not be redirected to another JavaVM.  OpenEJB relies on several
-    // thread local variables to opperate, the most important of which is ThreadContext which
-    // is used to coordiate transaction boundries.  At the very least to redirect calls to
a
-    // remote VM you will need a distributed TransactionManager.
-    //
     protected Object invoke(CoreDeploymentInfo deploymentInfo, AbstractEJBInvocation invocation)
throws OpenEJBException {
         Manager manager;
         synchronized (deploymentIdToManager) {

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java?rev=689706&r1=689705&r2=689706&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/java/org/apache/geronimo/openejb/cluster/stateful/container/WadiCache.java
Wed Aug 27 20:07:59 2008
@@ -44,10 +44,21 @@
 
     private final ConcurrentMap<Object, WadiInstance> localInstances = new ConcurrentHashMap<Object,
WadiInstance>();
 
-    private final CacheListener<Instance> cacheListener;
+    private CacheListener<Instance> listener;
 
-    public WadiCache(CacheListener<Instance> cacheListener) {
-        this.cacheListener = cacheListener;
+    public WadiCache() {
+    }
+
+    public WadiCache(CacheListener<Instance> listener) {
+        this.setListener(listener);
+    }
+
+    public synchronized CacheListener<Instance> getListener() {
+        return listener;
+    }
+
+    public synchronized void setListener(CacheListener<Instance> listener) {
+        this.listener = listener;
     }
 
     public SessionManager getSessionManager(Object deploymentId) {
@@ -232,7 +243,10 @@
             }
 
             try {
-                cacheListener.afterLoad(instance.instance);
+                CacheListener<Instance> listener = getListener();
+                if (listener != null) {
+                    listener.afterLoad(instance.instance);
+                }
                 localInstances.put(instance.instance.primaryKey, instance);
             } catch (Exception e) {
                 log.warn("Cannot activate migrated bean entry.", e);
@@ -246,7 +260,10 @@
             }
 
             try {
-                cacheListener.beforeStore(instance.instance);
+                CacheListener<Instance> listener = getListener();
+                if (listener != null) {
+                    listener.beforeStore(instance.instance);
+                }
                 localInstances.remove(instance.instance.primaryKey);
             } catch (Exception e) {
                 log.warn("Cannot passivate EJB for migration.", e);

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml?rev=689706&r1=689705&r2=689706&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/main/resources/META-INF/org.apache.geronimo.openejb.cluster/service-jar.xml
Wed Aug 27 20:07:59 2008
@@ -30,40 +30,9 @@
           id="Default Clustered Stateful Container"
           service="Container"
           types="STATEFUL"
-          constructor="id, transactionManager, securityService, Passivator, TimeOut, PoolSize,
BulkPassivate"
+          constructor="id, securityService"
           class-name="org.apache.geronimo.openejb.cluster.stateful.container.ClusteredStatefulContainer">
 
-    # The passivator is responsible for writing beans to disk
-    # at passivation time. Different passivators can be used
-    # by setting this property to the fully qualified class name
-    # of the PassivationStrategy implementation. The passivator
-    # is not responsible for invoking any callbacks or other
-    # processing, its only responsibly is to write the bean state
-    # to disk.
-    #
-    # Known implementations:
-    # org.apache.openejb.core.stateful.RAFPassivater
-    # org.apache.openejb.core.stateful.SimplePassivater
-
-    Passivator org.apache.openejb.core.stateful.SimplePassivater
-
-    # Specifies the time to wait between invocations. This
-    # value is measured in minutes. A value of 5 would
-    # result in a time-out of 5 minutes between invocations.
-    # A value of zero would mean no timeout.
-
-    TimeOut 20
-
-    # Specifies the size of the bean pools for this
-    # stateful SessionBean container.
-
-    PoolSize 1000
-
-    # Property name that specifies the number of instances
-    # to passivate at one time when doing bulk passivation.
-
-    BulkPassivate 100
-
   </ServiceProvider>
 
 </ServiceJar>

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainerTest.java?rev=689706&r1=689705&r2=689706&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainerTest.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-clustering-wadi/src/test/java/org/apache/geronimo/openejb/cluster/stateful/container/ClusteredStatefulContainerTest.java
Wed Aug 27 20:07:59 2008
@@ -22,8 +22,6 @@
 import java.net.URI;
 import java.util.Collections;
 
-import javax.transaction.TransactionManager;
-
 import org.apache.geronimo.clustering.wadi.WADISessionManager;
 import org.apache.geronimo.openejb.cluster.infra.NetworkConnectorTracker;
 import org.apache.openejb.OpenEJBException;
@@ -79,15 +77,9 @@
         tracker = (NetworkConnectorTracker) mock(NetworkConnectorTracker.class);
         modify().returnValue(tracker);
 
-        TransactionManager txManager = (TransactionManager) mock(TransactionManager.class);
         SecurityService securityService = (SecurityService) mock(SecurityService.class);
         container = (ClusteredStatefulContainer) intercept(ClusteredStatefulContainer.class,
new Object[] {"id",
-                txManager,
-                securityService,
-            null,
-            1,
-            1,
-            1});
+                securityService});
         deploymentId = "deploymentId";
         deploymentInfo = new CoreDeploymentInfo(new DeploymentContext(deploymentId, null,
null),
             SFSB.class,



Mime
View raw message