Search in sources :

Example 1 with AtomicRefSetCodec

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

the class AtomicRefProxy method getAndSetAsync.

@Override
public InternalCompletableFuture<T> getAndSetAsync(T newValue) {
    Data data = getContext().getSerializationService().toData(newValue);
    ClientMessage request = AtomicRefSetCodec.encodeRequest(groupId, objectName, data, true);
    ClientInvocationFuture future = new ClientInvocation(getClient(), request, name).invoke();
    return new ClientDelegatingFuture<>(future, getSerializationService(), AtomicRefSetCodec::decodeResponse);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) AtomicRefSetCodec(com.hazelcast.client.impl.protocol.codec.AtomicRefSetCodec) Data(com.hazelcast.internal.serialization.Data) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ClientInvocationFuture(com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)

Example 2 with AtomicRefSetCodec

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

the class AtomicRefProxy method setAsync.

@Override
public InternalCompletableFuture<Void> setAsync(T newValue) {
    Data data = getContext().getSerializationService().toData(newValue);
    ClientMessage request = AtomicRefSetCodec.encodeRequest(groupId, objectName, data, false);
    ClientInvocationFuture future = new ClientInvocation(getClient(), request, name).invoke();
    return new ClientDelegatingFuture<>(future, getSerializationService(), AtomicRefSetCodec::decodeResponse);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) AtomicRefSetCodec(com.hazelcast.client.impl.protocol.codec.AtomicRefSetCodec) Data(com.hazelcast.internal.serialization.Data) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ClientInvocationFuture(com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)

Aggregations

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