Examples of VisitableCommand


Examples of org.infinispan.commands.VisitableCommand

         if (!((String) key).endsWith(PROTO_KEY_SUFFIX)) {
            throw new CacheException("The key must end with \".proto\" : " + key);
         }

         // lock .errors key
         VisitableCommand cmd = commandsFactory.buildLockControlCommand(ERRORS_KEY_SUFFIX, null, null);
         invoker.invoke(ctx, cmd);

         final Object result = invokeNextInterceptor(ctx, command);

         if (command.isSuccessful()) {
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

   }

   @Override
   public Object visitClearCommand(InvocationContext ctx, ClearCommand command) throws Throwable {
      // lock .errors key
      VisitableCommand cmd = commandsFactory.buildLockControlCommand(ERRORS_KEY_SUFFIX, null, null);
      invoker.invoke(ctx, cmd);

      for (String fileName : serializationContext.getFileDescriptors().keySet()) {
         serializationContext.unregisterProtoFile(fileName);
      }
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

      return !((String) key).endsWith(ERRORS_KEY_SUFFIX);
   }

   private void updateGlobalErrors(InvocationContext ctx, Set<String> errorFiles) {
      // remove or update .errors accordingly
      VisitableCommand cmd;
      if (errorFiles.isEmpty()) {
         cmd = commandsFactory.buildRemoveCommand(ERRORS_KEY_SUFFIX, null, null);
      } else {
         StringBuilder sb = new StringBuilder();
         for (String fileName : errorFiles) {
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

      @Override
      public void handleError(String fileName, DescriptorParserException exception) {
         // handle first error per file, ignore the rest if any
         if (errorFiles.add(fileName)) {
            VisitableCommand cmd = commandsFactory.buildPutKeyValueCommand(fileName + ERRORS_KEY_SUFFIX, exception.getMessage(), null, null);
            invoker.invoke(ctx, cmd);
         }
      }
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

         }
      }

      @Override
      public void handleSuccess(String fileName) {
         VisitableCommand cmd = commandsFactory.buildRemoveCommand(fileName + ERRORS_KEY_SUFFIX, null, null);
         invoker.invoke(ctx, cmd);
      }
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

   /**
    * creates a commit()
    */
   protected void runCommitPhase(InvocationContext ctx, GlobalTransaction gtx, List<WriteCommand> modifications, boolean onePhaseCommit) {
      try {
         VisitableCommand commitCommand = onePhaseCommit ? buildPrepareCommand(gtx, modifications, true) : commandsFactory.buildCommitCommand(gtx);

         if (trace) log.trace("Running commit for " + gtx);

         handleCommitRollback(ctx, commitCommand);
         if (onePhaseCommit)
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

    * creates a rollback()
    */
   protected void runRollbackPhase(InvocationContext ctx, GlobalTransaction gtx, Transaction tx) {
      try {
         // JBCACHE-457
         VisitableCommand rollbackCommand = commandsFactory.buildRollbackCommand(gtx);
         if (trace) log.trace(" running rollback for {0}", gtx);
         transactionLog.rollback(gtx);

         //JBCACHE-359 Store a lookup for the globalTransaction so a listener
         // callback can find it
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

      this.icc = icc;
   }

   protected final Object processVisitableCommand(ReplicableCommand cacheCommand) throws Throwable {
      if (cacheCommand instanceof VisitableCommand) {
         VisitableCommand vc = (VisitableCommand) cacheCommand;
         final InvocationContext ctx;
         if (vc instanceof FlagAffectedCommand) {
            ctx = icc.createRemoteInvocationContextForCommand(vc);
         }
         else {
            ctx = icc.createRemoteInvocationContext();
         }
         if (vc.shouldInvoke(ctx)) {
            if (trace) log.trace("Invoking command " + cacheCommand + ", with originLocal flag set to " + ctx.isOriginLocal() + ".");
            return interceptorChain.invoke(ctx, vc);
         } else {
            if (trace) log.trace("Not invoking command " + cacheCommand + " since shouldInvoke() returned false with context " + ctx);
            return null;
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

   @Override
   public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable {
      if (!ctx.isOriginLocal()) {
         // replay modifications
         for (VisitableCommand modification : command.getModifications()) {
            VisitableCommand toReplay = getCommandToReplay(modification);
            if (toReplay != null) {
               invokeNextInterceptor(ctx, toReplay);
            }
         }
      }
View Full Code Here

Examples of org.infinispan.commands.VisitableCommand

   @Override
   public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable {
      if (!ctx.isOriginLocal()) {
         // replay modifications
         for (VisitableCommand modification : command.getModifications()) {
            VisitableCommand toReplay = getCommandToReplay(modification);
            if (toReplay != null) {
               invokeNextInterceptor(ctx, toReplay);
            }
         }
      }
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.