Package org.jboss.cache.commands.remote

Examples of org.jboss.cache.commands.remote.ReplicateCommand


   }

   public void testObjectFromByteBuffer() throws Exception
   {
      PutKeyValueCommand put = new PutKeyValueCommand(null, A_B, "name", "Joe");
      ReplicateCommand replicate = new ReplicateCommand(put);

      rman.setDefaultInactive(true);
      // register A as an inactive marshalling region
      Region region_A = rman.getRegion(A, true);
      region_A.registerContextClassLoader(this.getClass().getClassLoader());
View Full Code Here


      VersionAwareMarshaller marshaller = tl.marshaller;
      Map map = createMap(size);
      Fqn fqn = Fqn.fromString("/my/stuff");
      String key = "key";
      PutKeyValueCommand putCommand = new PutKeyValueCommand(null, fqn, key, map);
      ReplicateCommand replicateCommand = new ReplicateCommand(putCommand);

      byte[] buf = marshaller.objectToByteBuffer(replicateCommand);

      assertEquals(replicateCommand, marshaller.objectFromByteBuffer(buf));
   }
View Full Code Here

      }
   }

   public ReplicateCommand transformReplicateCommand(ReplicateCommand rc)
   {
      ReplicateCommand clone = rc.copy();
      if (rc.isSingleCommand())
      {
         clone.setSingleModification(transformFqns((VisitableCommand) rc.getSingleModification()));
      }
      else
      {
         List<ReplicableCommand> transformed = new ArrayList<ReplicableCommand>(rc.getModifications().size());
         for (ReplicableCommand cmd : rc.getModifications())
         {
            transformed.add(transformFqns((VisitableCommand) cmd));
         }
         clone.setModifications(transformed);
      }

      return clone;
   }
View Full Code Here

      }
   }

   public ReplicateCommand transformReplicateCommand(ReplicateCommand rc)
   {
      ReplicateCommand clone = rc.copy();
      if (rc.isSingleCommand())
      {
         clone.setSingleModification(transformFqns((VisitableCommand) rc.getSingleModification()));
      }
      else
      {
         List<ReplicableCommand> transformed = new ArrayList<ReplicableCommand>(rc.getModifications().size());
         for (ReplicableCommand cmd : rc.getModifications())
         {
            transformed.add(transformFqns((VisitableCommand) cmd));
         }
         clone.setModifications(transformed);
      }

      return clone;
   }
View Full Code Here

   }

   public void testObjectFromByteBuffer() throws Exception
   {
      PutKeyValueCommand put = new PutKeyValueCommand(null, A_B, "name", "Joe");
      ReplicateCommand replicate = new ReplicateCommand(put);

      rman.setDefaultInactive(true);
      // register A as an inactive marshalling region
      Region region_A = rman.getRegion(A, true);
      region_A.registerContextClassLoader(this.getClass().getClassLoader());
View Full Code Here

      VersionAwareMarshaller marshaller = tl.marshaller;
      Map map = createMap(size);
      Fqn fqn = Fqn.fromString("/my/stuff");
      String key = "key";
      PutKeyValueCommand putCommand = new PutKeyValueCommand(null, fqn, key, map);
      ReplicateCommand replicateCommand = new ReplicateCommand(putCommand);

      byte[] buf = marshaller.objectToByteBuffer(replicateCommand);

      assertEquals(replicateCommand, marshaller.objectFromByteBuffer(buf));
   }
View Full Code Here

      return cmd;
   }

   public ReplicateCommand buildReplicateCommand(ReplicableCommand command)
   {
      ReplicateCommand cmd = new ReplicateCommand(command);
      cmd.initialize(invoker);
      return cmd;
   }
View Full Code Here

      return cmd;
   }

   public ReplicateCommand buildReplicateCommand(List<ReplicableCommand> modifications)
   {
      ReplicateCommand cmd = new ReplicateCommand(modifications);
      cmd.initialize(invoker);
      return cmd;
   }
View Full Code Here

         // --- replicate methods
         case ReplicateCommand.MULTIPLE_METHOD_ID:
         case ReplicateCommand.SINGLE_METHOD_ID:
         {
            ReplicateCommand returnValue = new ReplicateCommand();
            returnValue.initialize(invoker);
            command = returnValue;
            break;
         }

         case InvalidateCommand.METHOD_ID:
         {
            InvalidateCommand returnValue = new InvalidateCommand();
            returnValue.initialize(cacheSpi, dataContainer, notifier);
            command = returnValue;
            break;
         }

         case ClusteredGetCommand.METHOD_ID:
         {
            ClusteredGetCommand returnValue = new ClusteredGetCommand();
            returnValue.initialize(dataContainer, invoker);
            command = returnValue;
            break;
         }
         // ---- Buddy replication - group organisation commands
         case AnnounceBuddyPoolNameCommand.METHOD_ID:
         {
            AnnounceBuddyPoolNameCommand returnValue = new AnnounceBuddyPoolNameCommand();
            returnValue.initialize(buddyManager);
            command = returnValue;
            break;
         }
         case AssignToBuddyGroupCommand.METHOD_ID:
         {
            AssignToBuddyGroupCommand returnValue = new AssignToBuddyGroupCommand();
            returnValue.initialize(buddyManager);
            command = returnValue;
            break;
         }
         case RemoveFromBuddyGroupCommand.METHOD_ID:
         {
            RemoveFromBuddyGroupCommand returnValue = new RemoveFromBuddyGroupCommand();
            returnValue.initialize(buddyManager);
            command = returnValue;
            break;
         }
         case DataGravitationCleanupCommand.METHOD_ID:
         {
            DataGravitationCleanupCommand returnValue = new DataGravitationCleanupCommand();
            returnValue.initialize(buddyManager, invoker, transactionTable, this, dataContainer, buddyFqnTransformer);
            command = returnValue;
            break;
         }
         case GravitateDataCommand.METHOD_ID:
         {
            GravitateDataCommand returnValue = new GravitateDataCommand(rpcManager.getLocalAddress());
            returnValue.initialize(dataContainer, cacheSpi, buddyFqnTransformer);
            command = returnValue;
            break;
         }
         default:
            throw new CacheException("Unknown command id " + id + "!");
View Full Code Here

      if (toReplicate.size() > 0)
      {
         try
         {

            ReplicateCommand replicateCommand = commandsFactory.buildReplicateCommand(toReplicate);
            // send to all live nodes in the cluster
            rpcManager.callRemoteMethods(null, replicateCommand, false, configuration.getSyncReplTimeout(), false);
         }
         catch (Throwable t)
         {
View Full Code Here

TOP

Related Classes of org.jboss.cache.commands.remote.ReplicateCommand

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.