org.infinispan.hotrod.impl.multimap.operations.PutKeyValueMultimapOperation Maven / Gradle / Ivy
The newest version!
package org.infinispan.hotrod.impl.multimap.operations;
import static org.infinispan.hotrod.impl.multimap.protocol.MultimapHotRodConstants.PUT_MULTIMAP_REQUEST;
import static org.infinispan.hotrod.impl.multimap.protocol.MultimapHotRodConstants.PUT_MULTIMAP_RESPONSE;
import org.infinispan.api.common.CacheWriteOptions;
import org.infinispan.hotrod.exceptions.InvalidResponseException;
import org.infinispan.hotrod.impl.DataFormat;
import org.infinispan.hotrod.impl.operations.OperationContext;
import org.infinispan.hotrod.impl.protocol.HotRodConstants;
import org.infinispan.hotrod.impl.transport.netty.HeaderDecoder;
import io.netty.buffer.ByteBuf;
import net.jcip.annotations.Immutable;
/**
* Implements "put" for multimap cache as defined by Hot Rod
* protocol specification.
*
* @since 14.0
*/
@Immutable
public class PutKeyValueMultimapOperation extends AbstractMultimapKeyValueOperation {
public PutKeyValueMultimapOperation(OperationContext operationContext,
K key, byte[] keyBytes,
byte[] value, CacheWriteOptions options,
DataFormat dataFormat, boolean supportsDuplicates) {
super(operationContext, PUT_MULTIMAP_REQUEST, PUT_MULTIMAP_RESPONSE, key, keyBytes, value, options, dataFormat, supportsDuplicates);
}
@Override
public void acceptResponse(ByteBuf buf, short status, HeaderDecoder decoder) {
if (!HotRodConstants.isSuccess(status)) {
throw new InvalidResponseException("Unexpected response status: " + Integer.toHexString(status));
}
complete(null);
}
}