[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...

Manik Surtani msurtani at jboss.com
Wed Oct 11 09:49:25 EDT 2006


  User: msurtani
  Date: 06/10/11 09:49:25

  Modified:    src/org/jboss/cache/interceptors  Tag:
                        Branch_JBossCache_1_4_0 TxInterceptor.java
  Log:
  JBCACHE-785
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.48.2.6  +20 -2     JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TxInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java,v
  retrieving revision 1.48.2.5
  retrieving revision 1.48.2.6
  diff -u -b -r1.48.2.5 -r1.48.2.6
  --- TxInterceptor.java	7 Jul 2006 21:32:19 -0000	1.48.2.5
  +++ TxInterceptor.java	11 Oct 2006 13:49:25 -0000	1.48.2.6
  @@ -87,11 +87,14 @@
           boolean scrubTxsOnExit = false;
           final boolean resumeSuspended;
           Option optionOverride = ctx.getOptionOverrides();
  -        ctx.setTransaction(txManager == null ? null : txManager.getTransaction());
  +       setTransactionInContext(ctx, txManager);
   
           if (optionOverride!= null && optionOverride.isFailSilently() && ctx.getTransaction() != null)
           {
               suspendedTransaction = txManager.suspend();
  +           // set the tx in the invocation context to null now! - JBCACHE-785
  +           ctx.setTransaction(null);
  +           ctx.setGlobalTransaction(null);
               resumeSuspended = true;
           } else {
               suspendedTransaction = null;
  @@ -184,6 +187,21 @@
           return result;
       }
   
  +   private void setTransactionInContext(InvocationContext ctx, TransactionManager txManager)
  +   {
  +      Transaction tx = null;
  +      try
  +      {
  +         tx = txManager == null ? null : txManager.getTransaction();
  +      }
  +      catch (SystemException se)
  +      {
  +      }
  +      
  +      ctx.setTransaction( tx == null || !isValid(tx) ? null : tx); // make sure the tx is valid, otherwise set as null - see JBCACHE-785  
  +      if (ctx.getTransaction() == null) ctx.setGlobalTransaction(null);  // nullify gtx as well
  +   }
  +
       public long getPrepares()
       {
           return m_prepares;
  
  
  



More information about the jboss-cvs-commits mailing list