org.infinispan.client.hotrod.impl.operations.ContainsKeyOperation Maven / Gradle / Ivy
package org.infinispan.client.hotrod.impl.operations;
import java.util.concurrent.atomic.AtomicInteger;
import org.infinispan.client.hotrod.configuration.Configuration;
import org.infinispan.client.hotrod.impl.protocol.Codec;
import org.infinispan.client.hotrod.impl.protocol.HotRodConstants;
import org.infinispan.client.hotrod.impl.transport.Transport;
import org.infinispan.client.hotrod.impl.transport.TransportFactory;
import net.jcip.annotations.Immutable;
/**
* Implements "containsKey" operation as described in Hot Rod protocol specification.
*
* @author [email protected]
* @since 4.1
*/
@Immutable
public class ContainsKeyOperation extends AbstractKeyOperation {
public ContainsKeyOperation(Codec codec, TransportFactory transportFactory, Object key, byte[] keyBytes,
byte[] cacheName, AtomicInteger topologyId, int flags, Configuration cfg) {
super(codec, transportFactory, key, keyBytes,cacheName, topologyId, flags, cfg);
}
@Override
protected Boolean executeOperation(Transport transport) {
boolean containsKey = false;
short status = sendKeyOperation(keyBytes, transport, CONTAINS_KEY_REQUEST, CONTAINS_KEY_RESPONSE);
if (HotRodConstants.isNotExist(status)) {
containsKey = false;
} else if (HotRodConstants.isSuccess(status)) {
containsKey = true;
}
return containsKey;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy