Examples of PrepareCommand


Examples of org.infinispan.commands.tx.PrepareCommand

      if (trace)
         log.trace("Retrieving/Applying pending prepares");
      Object object = marshaller.objectFromObjectStream(oi);
      while (object instanceof PrepareCommand) {
         PrepareCommand command = (PrepareCommand) object;

         if (!transactionLog.hasPendingPrepare(command)) {
            if (trace) log.tracef("Applying pending prepare %s", command);
            commandsFactory.initializeReplicableCommand(command, false);
            RemoteTxInvocationContext ctx = invocationContextContainer.createRemoteTxInvocationContext(null /* No idea if this right PLM */);
            RemoteTransaction transaction = txTable.createRemoteTransaction(command.getGlobalTransaction(), command.getModifications());
            ctx.setRemoteTransaction(transaction);
            ctx.setFlags(CACHE_MODE_LOCAL, Flag.SKIP_CACHE_STATUS_CHECK);
            interceptorChain.invoke(ctx, command);
         } else {
            if (trace) log.tracef("Prepare %s not in tx log; not applying", command);
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

   public void afterCommand(TxInvocationContext ctx, CommitCommand command) throws InterruptedException {
      if (!ctx.hasFlag(Flag.SKIP_LOCKING))
         txLock.readLock().unlock();

      if (loggingEnabled) {
         PrepareCommand pc = uncommittedPrepares.remove(command.getGlobalTransaction());
         if (pc == null)
            logModifications(ctx.getModifications());
         else
            logModificationsInTransaction(pc);
      }
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

      if (enabled) {
         loggingLock.readLock().lock();
         try {
            if (enabled) {
               if (trace) log.trace("Logging commit for tx {0}", command.getGlobalTransaction());
               PrepareCommand pc = uncommittedPrepares.remove(command.getGlobalTransaction());
               // TODO how can we handle this efficiently and safely?
//               for (WriteCommand wc : pc.getModifications())
//                  try {
//                     commandQueue.put(wc);
//                  } catch (InterruptedException e) {
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

   public void logPrepare(PrepareCommand command) {
      pendingPrepares.put(command.getGlobalTransaction(), command);
   }

   public void logCommit(GlobalTransaction gtx) {
      PrepareCommand command = pendingPrepares.remove(gtx);
      // it is perfectly normal for a prepare not to be logged for this gtx, for example if a transaction did not
      // modify anything, then beforeCompletion() is not invoked and logPrepare() will not be called to register the
      // prepare.
      if (command != null && isActive()) addEntry(gtx, command.getModifications());
   }
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

         if (trace)
            log.trace("Recieved prepare for tx: " + xid + " . Skipping call as 1PC will be used.");
         return XA_OK;
      }

      PrepareCommand prepareCommand = commandsFactory.buildPrepareCommand(globalTx, modifications, configuration.isOnePhaseCommit());
      if (trace) log.trace("Sending prepare command through the chain: " + prepareCommand);

      LocalTxInvocationContext ctx = icc.createTxInvocationContext();
      ctx.setXaCache(this);
      try {
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

      try {
         LocalTxInvocationContext ctx = icc.createTxInvocationContext();
         ctx.setXaCache(this);
         if (configuration.isOnePhaseCommit()) {
            if (trace) log.trace("Doing an 1PC prepare call on the interceptor chain");
            PrepareCommand command = commandsFactory.buildPrepareCommand(globalTx, modifications, true);
            try {
               invoker.invoke(ctx, command);
            } catch (Throwable e) {
               log.error("Error while processing 1PC PrepareCommand", e);
               throw new XAException(XAException.XAER_RMERR);
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

         switch (id) {
            case LockControlCommand.COMMAND_ID:
               command = new LockControlCommand(cacheName);
               break;
            case PrepareCommand.COMMAND_ID:
               command = new PrepareCommand(cacheName);
               break;
            case CommitCommand.COMMAND_ID:
               command = new CommitCommand(cacheName);
               break;
            case RollbackCommand.COMMAND_ID:
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

   public EvictCommand buildEvictCommand(Object key) {
      return new EvictCommand(key, notifier);
   }

   public PrepareCommand buildPrepareCommand(GlobalTransaction gtx, List<WriteCommand> modifications, boolean onePhaseCommit) {
      return new PrepareCommand(cacheName, gtx, modifications, onePhaseCommit);
   }
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

         case InvalidateL1Command.COMMAND_ID:
            InvalidateL1Command ilc = (InvalidateL1Command) c;
            ilc.init(configuration, distributionManager, notifier, dataContainer);
            break;
         case PrepareCommand.COMMAND_ID:
            PrepareCommand pc = (PrepareCommand) c;
            pc.init(interceptorChain, icc, txTable);
            pc.initialize(notifier, recoveryManager);
            if (pc.getModifications() != null)
               for (ReplicableCommand nested : pc.getModifications())  {
                  initializeReplicableCommand(nested, false);
               }
            pc.markTransactionAsRemote(isRemote);
            if (configuration.isEnableDeadlockDetection() && isRemote) {
               DldGlobalTransaction transaction = (DldGlobalTransaction) pc.getGlobalTransaction();
               transaction.setLocksHeldAtOrigin(pc.getAffectedKeys());
            }
            break;
         case CommitCommand.COMMAND_ID:
            CommitCommand commitCommand = (CommitCommand) c;
            commitCommand.init(interceptorChain, icc, txTable);
View Full Code Here

Examples of org.infinispan.commands.tx.PrepareCommand

   public void afterCommand(TxInvocationContext ctx, CommitCommand command) throws InterruptedException {
      if (!ctx.hasFlag(Flag.SKIP_LOCKING))
         releaseLockForTx();

      if (loggingEnabled) {
         PrepareCommand pc = uncommittedPrepares.remove(command.getGlobalTransaction());
         if (pc == null)
            logModifications(ctx.getModifications());
         else
            logModificationsInTransaction(pc);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.