Search in sources :

Example 1 with CacheSetExpiryPolicyCodec

use of com.hazelcast.client.impl.protocol.codec.CacheSetExpiryPolicyCodec in project hazelcast by hazelcast.

the class ClientCacheProxySupport method setExpiryPolicyInternal.

protected boolean setExpiryPolicyInternal(K key, ExpiryPolicy expiryPolicy) {
    ensureOpen();
    validateNotNull(key);
    validateNotNull(expiryPolicy);
    Data keyData = toData(key);
    Data expiryPolicyData = toData(expiryPolicy);
    List<Data> list = Collections.singletonList(keyData);
    ClientMessage request = CacheSetExpiryPolicyCodec.encodeRequest(nameWithPrefix, list, expiryPolicyData);
    ClientInvocationFuture future = invoke(request, keyData, IGNORE_COMPLETION);
    ClientDelegatingFuture<Boolean> delegatingFuture = newDelegatingFuture(future, CacheSetExpiryPolicyCodec::decodeResponse);
    try {
        return delegatingFuture.get();
    } catch (Throwable e) {
        throw rethrowAllowedTypeFirst(e, CacheException.class);
    }
}
Also used : CacheSetExpiryPolicyCodec(com.hazelcast.client.impl.protocol.codec.CacheSetExpiryPolicyCodec) CacheException(javax.cache.CacheException) Data(com.hazelcast.internal.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ClientInvocationFuture(com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)

Aggregations

ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)1 CacheSetExpiryPolicyCodec (com.hazelcast.client.impl.protocol.codec.CacheSetExpiryPolicyCodec)1 ClientInvocationFuture (com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)1 Data (com.hazelcast.internal.serialization.Data)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 CacheException (javax.cache.CacheException)1