Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.infinispan.client.hotrod.impl.operations;
 
 import java.util.Set;
 
Basic class for all hot rod operations that manipulate a key.

Author(s):
Mircea.Markus@jboss.com
Since:
4.1
public abstract class AbstractKeyOperation<T> extends RetryOnFailureOperation<T> {
   private static final BasicLogger log = BasicLogFactory.getLog(AbstractKeyOperation.class);
   protected final byte[] key;
   protected AbstractKeyOperation(Codec codecTransportFactory transportFactory,
            byte[] keybyte[] cacheNameAtomicInteger topologyIdFlag[] flags) {
      super(codectransportFactorycacheNametopologyIdflags);
      this. = key;
   }
   @Override
   protected Transport getTransport(int retryCountSet<SocketAddressfailedServers) {
      if (retryCount == 0) {
         return .getTransport(failedServers);
      } else {
         return .getTransport(failedServers);
      }
   }
   protected short sendKeyOperation(byte[] keyTransport transportbyte opCodebyte opRespCode) {
      // 1) write [header][key length][key]
      HeaderParams params = writeHeader(transportopCode);
      transport.writeArray(key);
      transport.flush();
      // 2) now read the header
      return readHeaderAndValidate(transportparams);
   }
   protected byte[] returnPossiblePrevValue(Transport transportshort status) {
      return .returnPossiblePrevValue(transportstatus);
   }
      //3) ...
      short respStatus = readHeaderAndValidate(transportparams);
      //4 ...
      if (respStatus ==  || respStatus == ) {
         code = ..;
      } else if (respStatus ==  || respStatus == ) {
      } else if (respStatus == ) {
      } else {
         throw new IllegalStateException("Unknown response status: " + Integer.toHexString(respStatus));
      }
      byte[] prevValue = returnPossiblePrevValue(transportrespStatus);
      return new VersionedOperationResponse(prevValuecode);
   }
New to GrepCode? Check out our FAQ X