Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.TransactionEntry


   @Override
   public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable
   {
      Object retVal = invokeNextInterceptor(ctx, command);
      TransactionEntry te = ctx.getTransactionEntry();
      if (te.hasLocalModifications())
      {
         PrepareCommand replicablePrepareCommand = command.clone(); // makre sure we remove any "local" transactions
         replicablePrepareCommand.removeModifications(te.getLocalModifications());
         command = replicablePrepareCommand;
      }

      if (!skipReplicationOfTransactionMethod(ctx)) runPreparePhase(command, command.getGlobalTransaction(), ctx);
      return retVal;
View Full Code Here


         if (trace)
         {
            log.trace("Data gravitation performed under global transaction " + gtx + ".  Not broadcasting cleanups until the tx commits.  Adding to tx mod list instead.");
         }
         transactionMods.put(gtx, cleanup);
         TransactionEntry te = getTransactionEntry(gtx);
         te.addModification(cleanup);
      }
   }
View Full Code Here

   }

   private void prepareCacheLoader(GlobalTransaction gtx, boolean onePhase) throws Exception
   {
      List<MethodCall> modifications;
      TransactionEntry entry;
      int txPuts = 0;

      entry = tx_table.get(gtx);
      if (entry == null)
      {
         throw new Exception("entry for transaction " + gtx + " not found in transaction table");
      }
      Set<Fqn> affectedFqns = new HashSet<Fqn>();
      modifications = entry.getCacheLoaderModifications();
      if (modifications.size() == 0)
      {
         if (trace) log.trace("Transaction has not logged any modifications!");
         return;
      }
View Full Code Here

      return retVal;
   }

   protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
   {
      TransactionEntry entry = tx_table.get(globalTransaction);
      if (trace)
      {
         log.trace("called to rollback cache with GlobalTransaction=" + globalTransaction);
      }

      if (entry == null)
      {
         log.error("entry for transaction " + globalTransaction + " not found (transaction has possibly already been rolled back)");
      }
      else
      {
         Iterator removedNodes = entry.getRemovedNodes().iterator();
         while (removedNodes.hasNext())
         {
            Fqn f = (Fqn) removedNodes.next();
            cacheImpl.realRemove(f, false);
         }
         // 1. Revert the modifications by running the undo-op list in reverse. This *cannot* throw any exceptions !
         entry.undoOperations(cache);
      }
      if (trace)
      {
         log.trace("bypassed locking as method rollback() doesn't require locking");
      }
View Full Code Here

      if (gtx == null && createIfNotExists)
      {
         Address addr = rpcManager.getLocalAddress();
         gtx = GlobalTransaction.create(addr);
         transactionTable.put(tx, gtx);
         TransactionEntry ent = null;
         try
         {
            ent = configuration.isNodeLockingOptimistic() ? new OptimisticTransactionEntry(tx) : new TransactionEntry(tx);
         }
         catch (Exception e)
         {
            throw new CacheException("Unable to create a transaction entry!", e);
         }
View Full Code Here

   }

   private void prepareCacheLoader(InvocationContext ctx) throws Exception
   {
      List<MethodCall> modifications;
      TransactionEntry entry;
      int txActs = 0;
      GlobalTransaction gtx = ctx.getGlobalTransaction();

      entry = tx_table.get(gtx);
      if (entry == null)
      {
         throw new Exception("entry for transaction " + gtx + " not found in transaction table");
      }
      modifications = entry.getCacheLoaderModifications();
      if (modifications.size() == 0)
      {
         return;
      }
      List cache_loader_modifications = new ArrayList();
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 = acquireLocksWithTimeout(ctx, fqn, NodeLock.LockType.WRITE, true, false, true, true, createdNodes, true);
      TransactionEntry entry = null;
      if (ctx.getGlobalTransaction() != null)
      {
         entry = tx_table.get(ctx.getGlobalTransaction());
         entry.addRemovedNode(fqn);
         for (NodeSPI nodeSPI : createdNodes)
         {
            entry.addRemovedNode(nodeSPI.getFqn());
            nodeSPI.markAsDeleted(true);
         }
      }
      acquireLocksOnChildren(peekNode(ctx, fqn, false, false, false), NodeLock.LockType.WRITE, ctx, entry, true);
View Full Code Here

    * Remove all locks held by <tt>tx</tt>, remove the transaction from the transaction table
    */
   private void commit(GlobalTransaction gtx)
   {
      if (trace) log.trace("committing cache with gtx " + gtx);
      TransactionEntry entry = tx_table.get(gtx);
      if (entry == null)
      {
         log.error("entry for transaction " + gtx + " not found (maybe already committed)");
         return;
      }

      // first remove nodes that should be deleted.
      Iterator removedNodes = entry.getRemovedNodes().iterator();
      while (removedNodes.hasNext())
      {
         Fqn f = (Fqn) removedNodes.next();
         cacheImpl.realRemove(f, false);
      }
View Full Code Here

         // Asssociate the local TX with the global TX. Create new
         // entry for TX in txTable, the modifications
         // below will need this entry to add their modifications
         // under the GlobalTx key
         TransactionEntry entry;
         if (txTable.get(gtx) == null)
         {
            // create a new transaction entry

            entry = configuration.isNodeLockingOptimistic() ? new OptimisticTransactionEntry(ltx) : new TransactionEntry(ltx);
            log.debug("creating new tx entry");
            txTable.put(gtx, entry);
            if (trace) log.trace("TxTable contents: " + txTable);
         }
         else
View Full Code Here

   {
      Option optionOverride = ctx.getOptionOverrides();
      if (optionOverride != null
            && (optionOverride.isForceAsynchronous() || optionOverride.isForceSynchronous()))
      {
         TransactionEntry entry = txTable.get(ctx.getGlobalTransaction());
         if (entry != null)
         {
            if (optionOverride.isForceAsynchronous())
               entry.setForceAsyncReplication(true);
            else
               entry.setForceSyncReplication(true);
         }
      }
   }
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.