Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.infinispan.client.hotrod.impl.operations;
 
 
 
Implements "putIfAbsent" operation as described in Hot Rod protocol specification.

Author(s):
Mircea.Markus@jboss.com
Since:
4.1
public class PutIfAbsentOperation extends AbstractKeyValueOperation<byte[]> {
   private static final BasicLogger log = BasicLogFactory.getLog(PutIfAbsentOperation.class);
   public PutIfAbsentOperation(Codec codecTransportFactory transportFactory,
                               byte[] keybyte[] cacheNameAtomicInteger topologyId,
                               Flag[] flagsbyte[] valuelong lifespan,TimeUnit lifespanTimeUnitlong maxIdleTimeTimeUnit maxIdleTimeUnit) {
      super(codectransportFactorykeycacheNametopologyIdflagsvaluelifespanlifespanTimeUnitmaxIdleTimemaxIdleTimeUnit);
   }
   @Override
   protected byte[] executeOperation(Transport transport) {
      short status = sendPutOperation(transport);
      byte[] previousValue = null;
      if (status ==  || status ==  || status == ) {
         previousValue = returnPossiblePrevValue(transportstatus);
         if (.isTraceEnabled()) {
            .tracef("Returning from putIfAbsent: %s", Util.printArray(previousValuefalse));
         }
      }
      return previousValue;
   }
New to GrepCode? Check out our FAQ X