Examples of PrepareCommand


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("Received 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

         LocalTxInvocationContext ctx = icc.createTxInvocationContext();
         ctx.setXaCache(this);
         if (configuration.isOnePhaseCommit()) {
            checkMarkedForRollback();
            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

         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.trace("Applying pending prepare {0}", command);
               commandsFactory.initializeReplicableCommand(command, false);
               RemoteTxInvocationContext ctx = invocationContextContainer.createRemoteTxInvocationContext();
               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.trace("Prepare {0} not in tx log; not applying", command);
View Full Code Here

Examples of org.jboss.cache.commands.tx.PrepareCommand

      command1 = new PutDataMapCommand(null, Fqn.ROOT, null);

      list = new ArrayList<WriteCommand>(2);
      list.add(command1);
      list.add(new PutDataMapCommand(null, Fqn.ROOT, null));
      prepareComand = new PrepareCommand(null, list, null, true);

      CacheMarshaller210 cm210 = new CacheMarshaller210();
      CommandsFactory factory = new CommandsFactoryImpl();
      cm210.injectCommandsFactory(factory);
View Full Code Here

Examples of org.jboss.cache.commands.tx.PrepareCommand

      stream.close();
      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(byteStream.toByteArray()));
      Object result = m.objectFromObjectStream(in);

      assertEquals(prepareComand.getClass(), result.getClass());
      PrepareCommand prepareCallRes = (PrepareCommand) result;
      List listResult = prepareCallRes.getModifications();

      assertEquals(list.size(), listResult.size());

      assert listResult.get(0) instanceof PutDataMapCommand;
      assert listResult.get(1) instanceof PutDataMapCommand;
View Full Code Here

Examples of org.jboss.cache.commands.tx.PrepareCommand

         if (trace)
            log.trace("Retrieving/Applying pending prepares");
         Object object = cache.getMarshaller().objectFromObjectStream(ois);
         while (object instanceof PrepareCommand)
         {
            PrepareCommand command = (PrepareCommand)object;
            if (! txLog.hasPendingPrepare(command))
            {
               InvocationContext ctx = container.get();
               ctx.setOriginLocal(false);
               ctx.getOptionOverrides().setCacheModeLocal(true);
View Full Code Here

Examples of org.jboss.cache.commands.tx.PrepareCommand

   {
      Object retVal = invokeNextInterceptor(ctx, command);
      TransactionContext transactionContext = ctx.getTransactionContext();
      if (transactionContext.hasLocalModifications())
      {
         PrepareCommand replicablePrepareCommand = command.copy(); // makre sure we remove any "local" transactions
         replicablePrepareCommand.removeModifications(transactionContext.getLocalModifications());
         command = replicablePrepareCommand;
      }

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

Examples of org.jboss.cache.commands.tx.PrepareCommand

      command1 = new PutDataMapCommand(null, Fqn.ROOT, null);

      list = new ArrayList<WriteCommand>(2);
      list.add(command1);
      list.add(new PutDataMapCommand(null, Fqn.ROOT, null));
      prepareComand = new PrepareCommand(null, list, null, true);

      CacheMarshaller210 cm210 = new CacheMarshaller210();
      CommandsFactory factory = new CommandsFactoryImpl();
      cm210.injectCommandsFactory(factory);
View Full Code Here

Examples of org.jboss.cache.commands.tx.PrepareCommand

      stream.close();
      ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(byteStream.toByteArray()));
      Object result = m.objectFromObjectStream(in);

      assertEquals(prepareComand.getClass(), result.getClass());
      PrepareCommand prepareCallRes = (PrepareCommand) result;
      List listResult = prepareCallRes.getModifications();

      assertEquals(list.size(), listResult.size());

      assert listResult.get(0) instanceof PutDataMapCommand;
      assert listResult.get(1) instanceof PutDataMapCommand;
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.