[jboss-cvs] JBossAS SVN: r63407 - trunk/ejb3/src/main/org/jboss/ejb3/cache/tree.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 7 17:40:06 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-06-07 17:40:06 -0400 (Thu, 07 Jun 2007)
New Revision: 63407

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/cache/tree/StatefulTreeCache.java
Log:
[JBAS-4476] Switch to JBC 2.0.0.CR2
[EJBTHREE-956] Replicate removed parent if it has live nested children

Modified: trunk/ejb3/src/main/org/jboss/ejb3/cache/tree/StatefulTreeCache.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/cache/tree/StatefulTreeCache.java	2007-06-07 21:37:38 UTC (rev 63406)
+++ trunk/ejb3/src/main/org/jboss/ejb3/cache/tree/StatefulTreeCache.java	2007-06-07 21:40:06 UTC (rev 63407)
@@ -72,12 +72,10 @@
 
    private static final String[] DEFAULT_HASH_BUCKETS = new String[DEFAULT_BUCKET_COUNT];
    
-   private static Option BYPASS_OPTION = new Option();
    private static Option LOCAL_ONLY_OPTION = new Option();
    private static Option GRAVITATE_OPTION = new Option();
    static
    {
-      BYPASS_OPTION.setBypassInterceptorChain(true);
       LOCAL_ONLY_OPTION.setCacheModeLocal(true);
       GRAVITATE_OPTION.setForceDataGravitation(true);
       
@@ -236,7 +234,16 @@
                pool.remove(ctx);
             
             if (ctx.getCanRemoveFromCache())
+            {
+               // Do a cluster-wide removal of the ctx
                cache.removeNode(id);
+            }
+            else
+            {
+               // We can't remove the ctx as it contains live nested beans
+               // But, we must replicate it so other nodes know the parent is removed!
+               putInCache(ctx);
+            }
             
             beans.remove(key);
          }
@@ -437,10 +444,8 @@
     */
    public class ClusteredStatefulCacheListener extends AbstractCacheListener
    {
-      // BES 11/18/2006 using nodeActivated callback was causing stack overflow; 
-      // switched to nodeLoaded, which gives direct access to the data      
       @Override
-      public void nodeLoaded(Fqn fqn, boolean pre, Map nodeData)
+      public void nodeActivated(Fqn fqn, boolean pre, Map nodeData)
       {
          // Ignore everything but "post" events for nodes in our region
          if(pre) return;
@@ -489,7 +494,7 @@
       }
 
       @Override
-      public void nodePassivated(Fqn fqn, boolean pre) 
+      public void nodePassivated(Fqn fqn, boolean pre, Map<Object, Object> data) 
       {
          // Ignore everything but "pre" events for nodes in our region
          if(!pre) return;
@@ -502,12 +507,7 @@
          try 
          {
             localActivity.set(Boolean.TRUE);
-            // EJBTHREE-746 Bypass interceptors and thus avoid generating another 
-            // eviction event (which will cause another attempt to passivate)
-            // Caller thread (eviction) already has a lock on the node
-            InvocationContext ctx = cache.getInvocationContext();
-            ctx.setOptionOverrides(getBypassOption());
-            bean = (StatefulBeanContext) cache.get(fqn, "bean");
+            bean = (StatefulBeanContext) data.get("bean");
             if (bean != null)
             {
                ClassLoader cl = classloader.get();
@@ -530,11 +530,6 @@
                
                bean.passivateAfterReplication();
             }
-         } 
-         catch (CacheException e) 
-         {
-            log.error("nodePassivate(): can't retrieve bean instance from: " +fqn + " with exception: " +e);
-            return;
          }
          catch (NoSuchEJBException e)
          {
@@ -576,18 +571,6 @@
       }
    }
    
-   private static Option getBypassOption()
-   {
-      try
-      {
-         return BYPASS_OPTION.clone();
-      }
-      catch (CloneNotSupportedException e)
-      {
-         throw new RuntimeException(e);
-      }
-   }
-   
    private static Option getLocalOnlyOption()
    {
       try




More information about the jboss-cvs-commits mailing list