Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.TransactionEntry


   }

   private void prepareCacheLoader(InvocationContext ctx) throws Throwable
   {
      GlobalTransaction gtx = ctx.getGlobalTransaction();
      TransactionEntry entry = ctx.getTransactionEntry();
      if (entry == null)
      {
         throw new Exception("entry for transaction " + gtx + " not found in transaction table");
      }
      List<Modification> cacheLoaderModifications = new ArrayList<Modification>();
View Full Code Here


   }

   @Override
   protected Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command) throws Throwable
   {
      TransactionEntry entry = ctx.getTransactionEntry();
      if (trace)
      {
         log.trace("called to rollback cache with GlobalTransaction=" + command.getGlobalTransaction());
      }
      if (entry == null)
      {
         log.error("entry for transaction " + command.getGlobalTransaction() + " not found (transaction has possibly already been rolled back)");
      }
      else
      {
         for (Fqn fqn : entry.getRemovedNodes())
         {
            dataContainer.removeFromDataStructure(fqn, false);
         }
         // 1. Revert the modifications by running the undo-op list in reverse. This *cannot* throw any exceptions !
         entry.undoOperations();
      }
      if (trace)
      {
         log.trace("bypassed locking as method rollback() doesn't require locking");
      }
View Full Code Here

      // need to make a note of ALL nodes created here!!
      List<NodeSPI> createdNodes = new LinkedList<NodeSPI>();
      // we need to mark new nodes created as deleted since they are only created to form a path to the node being removed, to
      // create a lock.
      boolean created = lockManager.lockPessimistically(ctx, command.getFqn(), WRITE, true, false, true, true, createdNodes, true);
      TransactionEntry entry = null;
      if (ctx.getGlobalTransaction() != null)
      {
         entry = ctx.getTransactionEntry();
         entry.addRemovedNode(command.getFqn());
         for (NodeSPI nodeSPI : createdNodes)
         {
            entry.addRemovedNode(nodeSPI.getFqn());
            nodeSPI.markAsDeleted(true);
         }
      }

      lockAllForRemoval(dataContainer.peek(command.getFqn(), false, false), ctx, entry);
View Full Code Here

      // tx-level overrides are more important
      Transaction tx = ctx.getTransaction();
      if (tx != null)
      {
         TransactionEntry te = ctx.getTransactionEntry();
         if (te != null)
         {
            if (te.isForceAsyncReplication()) sync = false;
            else if (te.isForceSyncReplication()) sync = true;
         }
      }

      replicateCall(recipients, c, sync, true, useOutOfBandMessage, false, syncReplTimeout);
   }
View Full Code Here

    */
   private void unlock(InvocationContext ctx)
   {
      try
      {
         TransactionEntry entry = ctx.getTransactionEntry();
         if (entry != null)
         {
            lockManager.unlock(ctx);
         }
      }
View Full Code Here

   {
      Option optionOverride = ctx.getOptionOverrides();
      if (optionOverride != null
            && (optionOverride.isForceAsynchronous() || optionOverride.isForceSynchronous()))
      {
         TransactionEntry entry = ctx.getTransactionEntry();
         if (entry != null)
         {
            if (optionOverride.isForceAsynchronous())
               entry.setForceAsyncReplication(true);
            else
               entry.setForceSyncReplication(true);
         }
      }
   }
View Full Code Here

   @Override
   protected void cleanupStaleLocks(InvocationContext ctx) throws Throwable
   {
      super.cleanupStaleLocks(ctx);
      TransactionEntry entry = ctx.getTransactionEntry();
      if (entry != null)
      {
         ((OptimisticTransactionEntry) entry).getTransactionWorkSpace().clearNodes();
      }
   }
View Full Code Here

   }

   protected void copyInvocationScopeOptionsToTxScope(InvocationContext ctx)
   {
      // notify the transaction entry that this override is in place.
      TransactionEntry entry = txTable.get(ctx.getGlobalTransaction());
      if (entry != null)
      {
         Option txScopeOption = new Option();
         txScopeOption.setCacheModeLocal(ctx.getOptionOverrides() != null && ctx.getOptionOverrides().isCacheModeLocal());
         txScopeOption.setSkipCacheStatusCheck(ctx.getOptionOverrides() != null && ctx.getOptionOverrides().isSkipCacheStatusCheck());
         entry.setOption(txScopeOption);
      }
   }
View Full Code Here

      if (tx != null)
      {
         if (trace) log.trace("Entering InvalidationInterceptor's prepare phase");
         // fetch the modifications before the transaction is committed (and thus removed from the txTable)
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         TransactionEntry entry = ctx.getTransactionEntry();
         if (entry == null) throw new IllegalStateException("cannot find transaction entry for " + gtx);

         if (entry.hasModifications())
         {
            List<ReversibleCommand> mods;
            if (entry.hasLocalModifications())
            {
               mods = new ArrayList<ReversibleCommand>(command.getModifications());
               mods.removeAll(entry.getLocalModifications());
            }
            else
            {
               mods = command.getModifications();
            }
View Full Code Here

      Transaction tx = ctx.getTransaction();
      if (tx != null)
      {
         // here we just record the modifications but actually do the invalidate in commit.
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         TransactionEntry entry = ctx.getTransactionEntry();
         if (entry == null) throw new IllegalStateException("cannot find transaction entry for " + gtx);

         if (entry.hasModifications())
         {
            List<ReversibleCommand> mods = new ArrayList<ReversibleCommand>(entry.getModifications());
            if (entry.hasLocalModifications()) mods.removeAll(entry.getLocalModifications());
            txMods.put(gtx, mods);
         }
      }
      return retval;
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.transaction.TransactionEntry

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.