Package org.infinispan.commands

Examples of org.infinispan.commands.ReplicableCommand


      }
   }

   public void readExternal(Object subject, ObjectInput input) throws IOException,
                                                                      ClassNotFoundException {
      ReplicableCommand command = (ReplicableCommand) subject;
      short methodId = input.readShort();
      byte numArgs = input.readByte();
      Object[] args = null;
      if (numArgs > 0) {
         args = new Object[numArgs];
         for (int i = 0; i < numArgs; i++) args[i] = input.readObject();
      }
      command.setParameters(methodId, args);
   }
View Full Code Here


    */
   @Override
   public Object handle(Message req) {
      if (isValid(req)) {
         try {
            ReplicableCommand cmd = (ReplicableCommand) req_marshaller.objectFromByteBuffer(req.getBuffer(), req.getOffset(), req.getLength());
            if (cmd instanceof CacheRpcCommand)
               return executeCommand((CacheRpcCommand) cmd, req);
            else
               return cmd.perform(null);
         } catch (Throwable x) {
            if (trace) log.trace("Problems invoking command.", x);
            return new ExceptionResponse(new CacheException("Problems invoking command.", x));
         }
      } else {
View Full Code Here

      }
   }

   @Override
   public List<WriteCommand> drain() {
      ReplicableCommand c = commandsFactory.buildRehashControlCommand(RehashControlCommand.Type.JOIN_TX_LOG_REQ, sender);
      RemoteTransactionLogDetails details = extractRemoteTransactionLogDetails(c);
      drainWithoutLock = details.isDrainNextCallWithoutLock();
      return details.getModifications();
   }
View Full Code Here

      return details.getModifications();
   }

   @Override
   public List<WriteCommand> drainAndLock(Address notUsed) {
      ReplicableCommand c = commandsFactory.buildRehashControlCommand(RehashControlCommand.Type.JOIN_TX_FINAL_LOG_REQ, sender);
      RemoteTransactionLogDetails details = extractRemoteTransactionLogDetails(c);
      pendingPrepares = details.getPendingPreparesMap();
      return details.getModifications();
   }
View Full Code Here

      return pendingPrepares;
   }

   @Override
   public void unlockAndDisable(Address notUsed) {
      ReplicableCommand c = commandsFactory.buildRehashControlCommand(RehashControlCommand.Type.JOIN_TX_LOG_CLOSE, sender);
      rpcManager.invokeRemotely(Collections.singleton(targetNode), c, true, true);
   }
View Full Code Here

    */
   @Override
   public Object handle(Message req) {
      if (isValid(req)) {
         try {
            ReplicableCommand cmd = (ReplicableCommand) req_marshaller.objectFromByteBuffer(req.getBuffer(), req.getOffset(), req.getLength());
            if (cmd instanceof CacheRpcCommand)
               return executeCommand((CacheRpcCommand) cmd, req);
            else
               return cmd.perform(null);
         } catch (Throwable x) {
            if (trace) log.trace("Problems invoking command.", x);
            return new ExceptionResponse(new CacheException("Problems invoking command.", x));
         }
      } else {
View Full Code Here

    */
   @Override
   public Object handle(Message req) {
      if (isValid(req)) {
         try {
            ReplicableCommand cmd = (ReplicableCommand) req_marshaller.objectFromByteBuffer(req.getBuffer(), req.getOffset(), req.getLength());
            if (cmd instanceof CacheRpcCommand)
               return executeCommand((CacheRpcCommand) cmd, req);
            else
               return cmd.perform(null);
         }
         catch (Throwable x) {
            if (trace) log.trace("Problems invoking command.", x);
            return new ExceptionResponse(new CacheException("Problems invoking command.", x));
         }
View Full Code Here

    * Message contains a Command. Execute it against *this* object and return result.
    */
   @Override
   public Object handle(Message req) {
      if (isValid(req)) {
         ReplicableCommand cmd = null;
         try {
            Object o = req_marshaller.objectFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength());
            if (o != null) {
               cmd = (ReplicableCommand) o;
               return executeCommand(cmd, req);
View Full Code Here

         if (distributionManager.isAffectedByRehash(clusteredGet.getKey()))
            return UnsureResponse.INSTANCE;
         return SuccessfulResponse.create(returnValue);
      } else if (command instanceof SingleRpcCommand) {
         SingleRpcCommand src = (SingleRpcCommand) command;
         ReplicableCommand c = src.getCommand();
         byte commandId = c.getCommandId();
         if (c instanceof WriteCommand) {
            if (returnValue == null) return null;
            // check if this is successful.
            WriteCommand wc = (WriteCommand) c;
            return handleWriteCommand(wc, returnValue);
         } else if (commandId == MapReduceCommand.COMMAND_ID || commandId == DistributedExecuteCommand.COMMAND_ID) {
            // Even null values should be wrapped in this case.
            return SuccessfulResponse.create(returnValue);
         } else if (c.isReturnValueExpected()) {
            if (returnValue == null) return null;
            return SuccessfulResponse.create(returnValue);
         }
      } else if (command.isReturnValueExpected()) {
         return SuccessfulResponse.create(returnValue);
View Full Code Here

   @Override
   public Response getResponse(CacheRpcCommand command, Object returnValue) {
      if (command instanceof SingleRpcCommand) {
         //https://issues.jboss.org/browse/ISPN-1984
         SingleRpcCommand src = (SingleRpcCommand) command;
         ReplicableCommand c = src.getCommand();
         if (c.getCommandId()== DistributedExecuteCommand.COMMAND_ID) {
            // Even null values should be wrapped in this case.
            return SuccessfulResponse.create(returnValue);
         }
      }
      if (returnValue == null) return null;
View Full Code Here

TOP

Related Classes of org.infinispan.commands.ReplicableCommand

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.