[jboss-dev-forums] [Design of the JBoss EJB Container] - Re: JBAS-4304 - Jboss calls ejbStore inside ejbPostCreate on

alex.loubyansky@jboss.com do-not-reply at jboss.com
Tue Apr 10 06:30:41 EDT 2007


What I did to fix it locally was add another impl of TxAssociation that I called NOT_READY which looked like
--- GlobalTxEntityMap.java      (revision 61533)
  | +++ GlobalTxEntityMap.java      (working copy)
  | @@ -196,6 +196,24 @@
  |        }
  |     };
  | 
  | +   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
  | +      {
  | +      }
  | +   };

Use it in the invokeHome of the EntityInstanceInterceptor
--- plugins/EntityInstanceInterceptor.java      (revision 61533)
  | +++ plugins/EntityInstanceInterceptor.java      (working copy)
  | @@ -111,6 +111,7 @@
  |        // Get context
  |        EntityContainer container = (EntityContainer) getContainer();
  |        EntityEnterpriseContext ctx = (EntityEnterpriseContext) container.getInstancePool().get();
  | +      ctx.setTxAssociation(org.jboss.ejb.GlobalTxEntityMap.NOT_READY);
  |        InstancePool pool = container.getInstancePool();

And in the EntityCreationInterceptor call scheduleSync on the default NONE TxAssociation
--- plugins/EntityCreationInterceptor.java      (revision 61533)
  | +++ plugins/EntityCreationInterceptor.java      (working copy)
  | @@ -51,11 +51,12 @@
  |           // copy from the context into the mi
  |           // interceptors down the chain look in the mi for the id not the ctx.
  |           mi.setId(ctx.getId());
  | 
  |           // invoke down the invoke chain
  |           // the final interceptor in EntityContainer will redirect this
  |           // call to postCreateEntity, which calls ejbPostCreate
  |           getNext().invoke(mi);
  | +         org.jboss.ejb.GlobalTxEntityMap.NONE.scheduleSync(mi.getTransaction(), ctx);
  |        }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035915#4035915

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035915



More information about the jboss-dev-forums mailing list