All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.hotrod.impl.operations.GetAndRemoveOperation Maven / Gradle / Ivy

There is a newer version: 14.0.32.Final
Show newest version
package org.infinispan.hotrod.impl.operations;

import org.infinispan.api.common.CacheEntry;
import org.infinispan.api.common.CacheOptions;
import org.infinispan.hotrod.impl.DataFormat;

import io.netty.buffer.ByteBuf;

/**
 * Implement "remove" operation as described in Hot Rod
 * protocol specification.
 *
 * @since 14.0
 */
public class GetAndRemoveOperation extends AbstractRemoveOperation> {

   public GetAndRemoveOperation(OperationContext operationContext,
         K key, byte[] keyBytes, CacheOptions options,
         DataFormat dataFormat) {
      super(operationContext, key, keyBytes, options, dataFormat);
   }

   @Override
   void completeNotExist() {
      complete(null);
   }

   @Override
   protected int flags() {
      return super.flags() | PrivateHotRodFlag.FORCE_RETURN_VALUE.getFlagInt();
   }

   @Override
   void completeExisted(ByteBuf buf, short status) {
      CacheEntry result = returnPossiblePrevValue(buf, status);
      statsDataRemove();
      complete(result); // NO_ERROR_STATUS
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy