Search in sources :

Example 1 with AtomicRefCompareAndSetCodec

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

the class AtomicRefProxy method compareAndSetAsync.

@Override
public InternalCompletableFuture<Boolean> compareAndSetAsync(T expect, T update) {
    Data expectedData = getContext().getSerializationService().toData(expect);
    Data newData = getContext().getSerializationService().toData(update);
    ClientMessage request = AtomicRefCompareAndSetCodec.encodeRequest(groupId, objectName, expectedData, newData);
    ClientInvocationFuture future = new ClientInvocation(getClient(), request, name).invoke();
    return new ClientDelegatingFuture<>(future, getSerializationService(), AtomicRefCompareAndSetCodec::decodeResponse);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) Data(com.hazelcast.internal.serialization.Data) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) AtomicRefCompareAndSetCodec(com.hazelcast.client.impl.protocol.codec.AtomicRefCompareAndSetCodec) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ClientInvocationFuture(com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)

Aggregations

ClientDelegatingFuture (com.hazelcast.client.impl.ClientDelegatingFuture)1 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)1 AtomicRefCompareAndSetCodec (com.hazelcast.client.impl.protocol.codec.AtomicRefCompareAndSetCodec)1 ClientInvocation (com.hazelcast.client.impl.spi.impl.ClientInvocation)1 ClientInvocationFuture (com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)1 Data (com.hazelcast.internal.serialization.Data)1