use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientCacheProxySupport method updateCacheListenerConfigOnOtherNodes.
protected void updateCacheListenerConfigOnOtherNodes(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, boolean isRegister) {
Collection<Member> members = getContext().getClusterService().getMemberList();
for (Member member : members) {
try {
UUID uuid = member.getUuid();
Data configData = toData(cacheEntryListenerConfiguration);
ClientMessage request = CacheListenerRegistrationCodec.encodeRequest(nameWithPrefix, configData, isRegister, uuid);
ClientInvocation invocation = new ClientInvocation(getClient(), request, getName(), uuid);
invocation.invoke();
} catch (Exception e) {
sneakyThrow(e);
}
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientCacheProxySupport method getInternal.
private ClientDelegatingFuture<V> getInternal(Data keyData, ExpiryPolicy expiryPolicy, boolean deserializeResponse) {
Data expiryPolicyData = toData(expiryPolicy);
ClientMessage request = CacheGetCodec.encodeRequest(nameWithPrefix, keyData, expiryPolicyData);
int partitionId = getContext().getPartitionService().getPartitionId(keyData);
ClientInvocation clientInvocation = new ClientInvocation(getClient(), request, name, partitionId);
ClientInvocationFuture future = clientInvocation.invoke();
return newDelegatingFuture(future, CacheGetCodec::decodeResponse, deserializeResponse);
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientCacheProxySupport method submitLoadAllTask.
private void submitLoadAllTask(ClientMessage request, CompletionListener completionListener, final List<Data> binaryKeys) {
final CompletionListener listener = completionListener != null ? injectDependencies(completionListener) : NULL_COMPLETION_LISTENER;
ClientDelegatingFuture<V> delegatingFuture = null;
try {
final long startNanos = nowInNanosOrDefault();
ClientInvocationFuture future = new ClientInvocation(getClient(), request, getName()).invoke();
delegatingFuture = newDelegatingFuture(future, clientMessage -> Boolean.TRUE);
final Future delFuture = delegatingFuture;
loadAllCalls.put(delegatingFuture, listener);
delegatingFuture.whenCompleteAsync((response, t) -> {
if (t == null) {
loadAllCalls.remove(delFuture);
onLoadAll(binaryKeys, startNanos);
listener.onCompletion();
} else {
loadAllCalls.remove(delFuture);
handleFailureOnCompletionListener(listener, t);
}
});
} catch (Throwable t) {
if (delegatingFuture != null) {
loadAllCalls.remove(delegatingFuture);
}
handleFailureOnCompletionListener(listener, t);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientCacheProxySupport method invoke.
protected ClientInvocationFuture invoke(ClientMessage req, int partitionId, int completionId) {
boolean completionOperation = completionId != -1;
if (completionOperation) {
listenerCompleter.registerCompletionLatch(completionId, 1);
}
try {
ClientInvocation clientInvocation = new ClientInvocation(getClient(), req, name, partitionId);
ClientInvocationFuture future = clientInvocation.invoke();
if (completionOperation) {
listenerCompleter.waitCompletionLatch(completionId, future);
}
return future;
} catch (Throwable e) {
if (e instanceof IllegalStateException) {
close();
}
if (completionOperation) {
listenerCompleter.deregisterCompletionLatch(completionId);
}
throw rethrowAllowedTypeFirst(e, CacheException.class);
}
}
use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientJobProxy method invokeJoinJob.
@Override
protected CompletableFuture<Void> invokeJoinJob() {
ClientMessage request = JetJoinSubmittedJobCodec.encodeRequest(getId(), lightJobCoordinator);
ClientInvocation invocation = invocation(request, coordinatorId());
// this invocation should never time out, as the job may be running for a long time
// 0 is not supported
invocation.setInvocationTimeoutMillis(Long.MAX_VALUE);
return invocation.invoke().thenApply(c -> null);
}
Aggregations