Package javax.ejb

Examples of javax.ejb.SessionSynchronization


      if (ctx.isTxSynchronized()) return;
      Transaction tx = tm.getTransaction();
      if (tx == null) return;
      if (tx.getStatus() == Status.STATUS_MARKED_ROLLBACK) return;
      SFSBSessionSynchronization synch = new SFSBSessionSynchronization(ctx);
      SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
      try
      {
         bean.afterBegin();
      }
      catch (EJBException e)
      {
         throw e;
      }
View Full Code Here


         this.ctx = ctx;
      }

      public void beforeCompletion()
      {
         SessionSynchronization bean = (SessionSynchronization) ctx.getInstance();
         try
         {
            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()
      {
         final 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);
           
            // TODO: use interceptors to setup a context
            SessionInvocationContext invocation = new BaseSessionInvocationContext(null, null, null) {
               @Override
               public Object proceed() throws Exception
               {
                  bean.beforeCompletion();
                  return null;
               }
            };
            invocation.setEJBContext(ctx.getEJBContext());
            CurrentInvocationContext.push(invocation);
View Full Code Here

      }

      public void afterCompletion(final int status)
      {
         ctx.setTxSynchronized(false);
         final 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
         {
            // TODO: use interceptors to setup a context
            SessionInvocationContext invocation = new BaseSessionInvocationContext(null, null, null) {
               @Override
               public Object proceed() throws Exception
               {
                  if (status == Status.STATUS_COMMITTED)
                  {
                     bean.afterCompletion(true);
                  }
                  else
                  {
                     bean.afterCompletion(false);
                  }
                  return null;
               }
            };
            invocation.setEJBContext(ctx.getEJBContext());
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
         {
            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

         this.ctx = ctx;
      }

      public void beforeCompletion()
      {
         final SessionSynchronization sync = ctx.getSessionSynchronization();
         // The bean might be lost in action if an exception is thrown in afterBegin
         if(ctx.getInstance() == 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);
           
            // TODO: use interceptors to setup a context
            SessionInvocationContext invocation = new BaseSessionInvocationContext(null, null, null) {
               @Override
               public Object proceed() throws Exception
               {
                  sync.beforeCompletion();
                  return null;
               }
            };
            invocation.setEJBContext(ctx.getEJBContext());
            CurrentInvocationContext.push(invocation);
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.