Package org.jboss.cache.commands.tx

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


      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

         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

   {
      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

      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

      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

      return buildPrepareCommand(gtx, Collections.singletonList(command), rpcManager.getLocalAddress(), onePhaseCommit);
   }

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

         }
         // --- transactional method calls

         case PrepareCommand.METHOD_ID:
         {
            command = new PrepareCommand();
            break;
         }

         case OptimisticPrepareCommand.METHOD_ID:
         {
View Full Code Here

      {
         case OptimisticPrepareCommand.METHOD_ID:
         case PrepareCommand.METHOD_ID:

            // Prepare method has a list of modifications. We will just take the first one and extract.
            PrepareCommand pc = (PrepareCommand) cmd;
            List<WriteCommand> modifications = pc.getModifications();
            fqn = extractFqn(modifications.get(0));

            // If this is two phase commit, map the FQN to the GTX so
            // we can find it when the commit/rollback comes through
            if (!pc.isOnePhaseCommit()) transactions.put(pc.getGlobalTransaction(), fqn);

            break;

         case RollbackCommand.METHOD_ID:
         case CommitCommand.METHOD_ID:
View Full Code Here

               {
                  it.remove();
               }
               else if (realOne.getSingleModification() instanceof PrepareCommand) //explicit transaction
               {
                  PrepareCommand prepareCommand = (PrepareCommand) realOne.getSingleModification();
                  if (prepareCommand.containsModificationType(replicableCommandClass))
                  {
                     it.remove();
                  }
               }
            }
View Full Code Here

TOP

Related Classes of org.jboss.cache.commands.tx.PrepareCommand

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.