use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientCacheIterator method fetch.
protected List fetch() {
HazelcastClientInstanceImpl client = (HazelcastClientInstanceImpl) context.getHazelcastInstance();
String name = cacheProxy.getPrefixedName();
if (prefetchValues) {
ClientMessage request = CacheIterateEntriesCodec.encodeRequest(name, encodePointers(pointers), fetchSize);
try {
ClientInvocation clientInvocation = new ClientInvocation(client, request, name, partitionIndex);
ClientInvocationFuture future = clientInvocation.invoke();
CacheIterateEntriesCodec.ResponseParameters responseParameters = CacheIterateEntriesCodec.decodeResponse(future.get());
IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
setIterationPointers(responseParameters.entries, pointers);
return responseParameters.entries;
} catch (Exception e) {
throw rethrow(e);
}
} else {
ClientMessage request = CacheIterateCodec.encodeRequest(name, encodePointers(pointers), fetchSize);
try {
ClientInvocation clientInvocation = new ClientInvocation(client, request, name, partitionIndex);
ClientInvocationFuture future = clientInvocation.invoke();
CacheIterateCodec.ResponseParameters responseParameters = CacheIterateCodec.decodeResponse(future.get());
IterationPointer[] pointers = decodePointers(responseParameters.iterationPointers);
setIterationPointers(responseParameters.keys, pointers);
return responseParameters.keys;
} catch (Exception e) {
throw rethrow(e);
}
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientCacheProxy method subscribeToEventJournal.
@Override
public InternalCompletableFuture<EventJournalInitialSubscriberState> subscribeToEventJournal(int partitionId) {
final ClientMessage request = CacheEventJournalSubscribeCodec.encodeRequest(nameWithPrefix);
final ClientInvocationFuture fut = new ClientInvocation(getClient(), request, getName(), partitionId).invoke();
return new ClientDelegatingFuture<>(fut, getSerializationService(), eventJournalSubscribeResponseDecoder);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientCacheProxy method readFromEventJournal.
@Override
public <T> InternalCompletableFuture<ReadResultSet<T>> readFromEventJournal(long startSequence, int minSize, int maxSize, int partitionId, Predicate<? super EventJournalCacheEvent<K, V>> predicate, Function<? super EventJournalCacheEvent<K, V>, ? extends T> projection) {
if (maxSize < minSize) {
throw new IllegalArgumentException("maxSize " + maxSize + " must be greater or equal to minSize " + minSize);
}
final SerializationService ss = getSerializationService();
final ClientMessage request = CacheEventJournalReadCodec.encodeRequest(nameWithPrefix, startSequence, minSize, maxSize, ss.toData(predicate), ss.toData(projection));
final ClientInvocationFuture fut = new ClientInvocation(getClient(), request, getName(), partitionId).invoke();
return new ClientDelegatingFuture<>(fut, ss, eventJournalReadResponseDecoder);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientCacheProxySupport method callPutAsync.
protected CompletableFuture callPutAsync(K key, Data keyData, V value, Data valueData, Data expiryPolicyData, boolean isGet, boolean withCompletionEvent, BiConsumer<V, Throwable> statsCallback) {
ClientInvocationFuture invocationFuture = putInternal(keyData, valueData, expiryPolicyData, isGet, withCompletionEvent);
InternalCompletableFuture future = newDelegatingFuture(invocationFuture, CachePutCodec::decodeResponse);
return addCallback(future, statsCallback);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class AtomicLongProxy method addAndGetAsync.
@Override
public InternalCompletableFuture<Long> addAndGetAsync(long delta) {
ClientMessage request = AtomicLongAddAndGetCodec.encodeRequest(groupId, objectName, delta);
ClientInvocationFuture future = new ClientInvocation(getClient(), request, name).invoke();
return new ClientDelegatingFuture<>(future, getSerializationService(), AtomicLongAddAndGetCodec::decodeResponse);
}
Aggregations