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

Manik Surtani manik at jboss.org
Wed May 23 14:44:56 EDT 2007


  User: msurtani
  Date: 07/05/23 14:44:56

  Modified:    src/org/jboss/cache/interceptors  TxInterceptor.java
  Log:
  BR method opts
  
  Revision  Changes    Path
  1.82      +25 -5     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.81
  retrieving revision 1.82
  diff -u -b -r1.81 -r1.82
  --- TxInterceptor.java	23 May 2007 15:22:03 -0000	1.81
  +++ TxInterceptor.java	23 May 2007 18:44:56 -0000	1.82
  @@ -335,7 +335,7 @@
         }
   
         // register a sync handler for this tx - only if the gtx is not remotely initiated.
  -      GlobalTransaction gtx = registerTransaction(tx);
  +      GlobalTransaction gtx = registerTransaction(tx, ctx);
         if (gtx != null)
         {
            m = replaceGtx(m, gtx);
  @@ -848,7 +848,7 @@
       * @return
       * @throws Exception
       */
  -   private GlobalTransaction registerTransaction(Transaction tx) throws Exception
  +   private GlobalTransaction registerTransaction(Transaction tx, InvocationContext ctx) throws Exception
      {
         GlobalTransaction gtx;
         if (isValid(tx) && transactions.put(tx, NULL) == null)
  @@ -868,7 +868,8 @@
               {
                  log.trace("Registering sync handler for tx " + tx + ", gtx " + gtx);
               }
  -            LocalSynchronizationHandler myHandler = new LocalSynchronizationHandler(gtx, tx, cache);
  +            // see the comment in the LocalSyncHandler for the last isOriginLocal param.
  +            LocalSynchronizationHandler myHandler = new LocalSynchronizationHandler(gtx, tx, cache, !ctx.isOriginLocal());
               registerHandler(tx, myHandler);
            }
         }
  @@ -1083,17 +1084,36 @@
      private class LocalSynchronizationHandler extends RemoteSynchronizationHandler
      {
         private boolean localRollbackOnly = true;
  +      // a VERY strange situation where a tx has remote origins, but since certain buddy group org methods perform local
  +      // cleanups even when remotely triggered, and optimistic locking is used, you end up with an implicit local tx.
  +      // This is STILL remotely originating though and this needs to be made explicit here.
  +      // this can be checked by inspecting the InvocationContext.isOriginLocal() at the time of registering the sync.
  +      private boolean remoteLocal = false;
   
  -      LocalSynchronizationHandler(GlobalTransaction gtx, Transaction tx, CacheSPI cache)
  +      /**
  +       * A Synchronization for locally originating txs.
  +       * <p/>
  +       * a VERY strange situation where a tx has remote origins, but since certain buddy group org methods perform local
  +       * cleanups even when remotely triggered, and optimistic locking is used, you end up with an implicit local tx.
  +       * This is STILL remotely originating though and this needs to be made explicit here.
  +       * this can be checked by inspecting the InvocationContext.isOriginLocal() at the time of registering the sync.
  +       *
  +       * @param gtx
  +       * @param tx
  +       * @param cache
  +       * @param remoteLocal
  +       */
  +      LocalSynchronizationHandler(GlobalTransaction gtx, Transaction tx, CacheSPI cache, boolean remoteLocal)
         {
            super(gtx, tx, cache);
  +         this.remoteLocal = remoteLocal;
         }
   
         @Override
         public void beforeCompletion()
         {
            super.beforeCompletion();
  -         ctx.setOriginLocal(true); // this is the LOCAL sync handler after all!
  +         ctx.setOriginLocal(!remoteLocal); // this is the LOCAL sync handler after all!
            // fetch the modifications before the transaction is committed
            // (and thus removed from the txTable)
            setTransactionalContext(tx, gtx, ctx);
  
  
  



More information about the jboss-cvs-commits mailing list