Package javax.ejb

Examples of javax.ejb.SessionSynchronization


      }

      public void afterCompletion(final int status)
      {
         ctx.setTxSynchronized(false);
         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
         {
            // 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)
                  {
                     sync.afterCompletion(true);
                  }
                  else
                  {
                     sync.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

/* 107 */     if (ctx.isTxSynchronized()) return;
/* 108 */     Transaction tx = this.tm.getTransaction();
/* 109 */     if (tx == null) return;
/* 110 */     if (tx.getStatus() == 1) return;
/* 111 */     SFSBSessionSynchronization synch = new SFSBSessionSynchronization(ctx);
/* 112 */     SessionSynchronization bean = (SessionSynchronization)ctx.getInstance();
/*     */     try
/*     */     {
/* 115 */       bean.afterBegin();
/*     */     }
/*     */     catch (EJBException e)
/*     */     {
/* 119 */       throw e;
/*     */     }
View Full Code Here

/*  63 */       this.ctx = ctx;
/*     */     }
/*     */
/*     */     public void beforeCompletion()
/*     */     {
/*  68 */       SessionSynchronization bean = (SessionSynchronization)this.ctx.getInstance();
/*     */       try
/*     */       {
/*  71 */         bean.beforeCompletion();
/*     */       }
/*     */       catch (RemoteException e)
/*     */       {
/*  75 */         throw new RuntimeException(e);
/*     */       }
View Full Code Here

/*     */     }
/*     */
/*     */     public void afterCompletion(int status)
/*     */     {
/*  81 */       this.ctx.setTxSynchronized(false);
/*  82 */       SessionSynchronization bean = (SessionSynchronization)this.ctx.getInstance();
/*     */       try
/*     */       {
/*  85 */         if (status == 3)
/*     */         {
/*  87 */           bean.afterCompletion(true);
/*     */         }
/*     */         else
/*     */         {
/*  91 */           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

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.