Package javax.ejb

Examples of javax.ejb.SessionSynchronization


   public Object invoke(Invocation invocation) throws Throwable
   {
      Object target = invocation.getTargetObject();
      if(!(target instanceof SessionSynchronization))
         throw new IllegalArgumentException("target not an instance of SessionSynchronization " + target);
      SessionSynchronization synch = (SessionSynchronization) invocation.getTargetObject();
      // fake tx semantics
      synch.afterBegin();
      Object result = invocation.invokeNext();
      synch.beforeCompletion();
      synch.afterCompletion(true);
      return result;
   }
View Full Code Here


         log.warn("Unexpected RollbackException from tx " + tx + " with status " + tx.getStatus());
         throw new EJBException(e);
      }
      // Notify StatefulInstanceInterceptor that the synch will take care of the release.
      ctx.setTxSynchronized(true);
      SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
      // EJB 3 4.3.7 paragraph 2
      bean.afterBegin();
   }
View Full Code Here

         this.ctx = ctx;
      }

      public void beforeCompletion()
      {
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         // The bean might be lost in action if an exception is thrown in afterBegin
         if(bean == null)
            return;
         pushEnc();
         try
         {
            // FIXME: This is a dirty hack to notify AS EJBTimerService about what's going on
            AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_BEFORE_COMPLETION);
           
            bean.beforeCompletion();
         }
         catch (RemoteException e)
         {
            throw new RuntimeException(e);
         }
View Full Code Here

      }

      public void afterCompletion(int status)
      {
         ctx.setTxSynchronized(false);
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         // The bean might be lost in action if an exception is thrown in afterBegin
         if(bean == null)
            return;
         pushEnc();
         try
         {
            if (status == Status.STATUS_COMMITTED)
            {
               bean.afterCompletion(true);
            }
            else
            {
               bean.afterCompletion(false);
            }
         }
         catch (RemoteException ignore)
         {
         }
View Full Code Here

         log.warn("Unexpected RollbackException from tx " + tx + " with status " + tx.getStatus());
         throw new EJBException(e);
      }
      // Notify StatefulInstanceInterceptor that the synch will take care of the release.
      ctx.setTxSynchronized(true);
      SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
      // EJB 3 4.3.7 paragraph 2
      bean.afterBegin();
   }
View Full Code Here

         this.ctx = ctx;
      }

      public void beforeCompletion()
      {
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         try
         {
            // FIXME: This is a dirty hack to notify AS EJBTimerService about what's going on
            AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_BEFORE_COMPLETION);
           
            bean.beforeCompletion();
         }
         catch (RemoteException e)
         {
            throw new RuntimeException(e);
         }
View Full Code Here

      }

      public void afterCompletion(int status)
      {
         ctx.setTxSynchronized(false);
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         try
         {
            if (status == Status.STATUS_COMMITTED)
            {
               bean.afterCompletion(true);
            }
            else
            {
               bean.afterCompletion(false);
            }
         }
         catch (RemoteException ignore)
         {
         }
View Full Code Here

         log.warn("Unexpected RollbackException from tx " + tx + " with status " + tx.getStatus());
         throw new EJBException(e);
      }
      // Notify StatefulInstanceInterceptor that the synch will take care of the release.
      ctx.setTxSynchronized(true);
      SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
      // EJB 3 4.3.7 paragraph 2
      bean.afterBegin();
   }
View Full Code Here

         this.ctx = ctx;
      }

      public void beforeCompletion()
      {
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         // The bean might be lost in action if an exception is thrown in afterBegin
         if(bean == null)
            return;
         pushEnc();
         try
         {
            // FIXME: This is a dirty hack to notify AS EJBTimerService about what's going on
            AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsAssociation.IN_BEFORE_COMPLETION);
           
            bean.beforeCompletion();
         }
         catch (RemoteException e)
         {
            throw new RuntimeException(e);
         }
View Full Code Here

      }

      public void afterCompletion(int status)
      {
         ctx.setTxSynchronized(false);
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         // The bean might be lost in action if an exception is thrown in afterBegin
         if(bean == null)
            return;
         pushEnc();
         try
         {
            if (status == Status.STATUS_COMMITTED)
            {
               bean.afterCompletion(true);
            }
            else
            {
               bean.afterCompletion(false);
            }
         }
         catch (RemoteException ignore)
         {
         }
View Full Code Here

TOP

Related Classes of javax.ejb.SessionSynchronization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.