[jboss-cvs] JBossAS SVN: r62314 - in trunk/server/src/main/org/jboss/ejb: plugins and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 13 05:11:58 EDT 2007


Author: alex.loubyansky at jboss.com
Date: 2007-04-13 05:11:58 -0400 (Fri, 13 Apr 2007)
New Revision: 62314

Modified:
   trunk/server/src/main/org/jboss/ejb/GlobalTxEntityMap.java
   trunk/server/src/main/org/jboss/ejb/plugins/EntityCreationInterceptor.java
   trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
Log:
JBAS-4304

Modified: trunk/server/src/main/org/jboss/ejb/GlobalTxEntityMap.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/GlobalTxEntityMap.java	2007-04-12 22:14:56 UTC (rev 62313)
+++ trunk/server/src/main/org/jboss/ejb/GlobalTxEntityMap.java	2007-04-13 09:11:58 UTC (rev 62314)
@@ -211,6 +211,25 @@
    };
 
    /**
+    * Used for instances in the create phase,
+    * i.e. before the ejbCreate and until after the ejbPostCreate returns
+    */
+   public static final TxAssociation NOT_READY = new TxAssociation()
+   {
+      public void scheduleSync(Transaction tx, EntityEnterpriseContext instance)
+      {
+      }
+
+      public void synchronize(Thread thread, Transaction tx, EntityEnterpriseContext instance) throws Exception
+      {
+      }
+
+      public void invokeEjbStore(Thread thread, EntityEnterpriseContext instance) throws Exception
+      {
+      }
+   };
+
+   /**
     * sync all EntityEnterpriseContext that are involved (and changed)
     * within a transaction.
     */

Modified: trunk/server/src/main/org/jboss/ejb/plugins/EntityCreationInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/EntityCreationInterceptor.java	2007-04-12 22:14:56 UTC (rev 62313)
+++ trunk/server/src/main/org/jboss/ejb/plugins/EntityCreationInterceptor.java	2007-04-13 09:11:58 UTC (rev 62314)
@@ -22,7 +22,9 @@
 package org.jboss.ejb.plugins;
 
 import org.jboss.ejb.EntityEnterpriseContext;
+import org.jboss.ejb.GlobalTxEntityMap;
 import org.jboss.invocation.Invocation;
+import org.jboss.tm.TxUtils;
 
 
 /**
@@ -56,8 +58,14 @@
          // the final interceptor in EntityContainer will redirect this
          // call to postCreateEntity, which calls ejbPostCreate
          getNext().invoke(mi);
+
+         // now it's ready and can be scheduled for the synchronization
+         if(TxUtils.isActive(mi.getTransaction()))
+         {
+            GlobalTxEntityMap.NONE.scheduleSync(mi.getTransaction(), ctx);
+         }
       }
-      
+
       return retVal;
    }
 

Modified: trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java
===================================================================
--- trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java	2007-04-12 22:14:56 UTC (rev 62313)
+++ trunk/server/src/main/org/jboss/ejb/plugins/EntityInstanceInterceptor.java	2007-04-13 09:11:58 UTC (rev 62314)
@@ -28,6 +28,7 @@
 import org.jboss.ejb.InstanceCache;
 import org.jboss.ejb.AllowedOperationsAssociation;
 import org.jboss.ejb.InstancePool;
+import org.jboss.ejb.GlobalTxEntityMap;
 import org.jboss.invocation.Invocation;
 import org.jboss.invocation.InvocationType;
 import org.jboss.util.NestedRuntimeException;
@@ -111,6 +112,7 @@
       // Get context
       EntityContainer container = (EntityContainer) getContainer();
       EntityEnterpriseContext ctx = (EntityEnterpriseContext) container.getInstancePool().get();
+      ctx.setTxAssociation(GlobalTxEntityMap.NOT_READY);
       InstancePool pool = container.getInstancePool();
 
       // Pass it to the method invocation




More information about the jboss-cvs-commits mailing list