use of com.hazelcast.client.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientPartitionCancellableDelegatingFuture method invokeCancelRequest.
private boolean invokeCancelRequest(boolean mayInterruptIfRunning) throws InterruptedException {
waitForRequestToBeSend();
ClientInvocation clientInvocation;
final HazelcastClientInstanceImpl client = (HazelcastClientInstanceImpl) context.getHazelcastInstance();
ClientMessage request = ExecutorServiceCancelOnPartitionCodec.encodeRequest(uuid, partitionId, mayInterruptIfRunning);
clientInvocation = new ClientInvocation(client, request, partitionId);
try {
ClientInvocationFuture f = clientInvocation.invoke();
return ExecutorServiceCancelOnPartitionCodec.decodeResponse(f.get()).response;
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientMapProxy method submitToKeyInternal.
public void submitToKeyInternal(Data keyData, EntryProcessor entryProcessor, final ExecutionCallback callback) {
ClientMessage request = MapSubmitToKeyCodec.encodeRequest(name, toData(entryProcessor), keyData, getThreadId());
try {
ClientInvocationFuture future = invokeOnKeyOwner(request, keyData);
SerializationService serializationService = getContext().getSerializationService();
ClientDelegatingFuture clientDelegatingFuture = new ClientDelegatingFuture(future, serializationService, SUBMIT_TO_KEY_RESPONSE_DECODER);
clientDelegatingFuture.andThen(callback);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceProxy method retrieveResult.
@Override
public <T> Future<T> retrieveResult(long taskId) {
int partitionId = Bits.extractInt(taskId, false);
int sequence = Bits.extractInt(taskId, true);
ClientMessage clientMessage = DurableExecutorRetrieveResultCodec.encodeRequest(name, sequence);
ClientInvocationFuture future = new ClientInvocation(getClient(), clientMessage, partitionId).invoke();
return new ClientDelegatingFuture<T>(future, getSerializationService(), RETRIEVE_RESPONSE_DECODER);
}
use of com.hazelcast.client.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientExecutorServiceProxy method submitToTargetInternal.
private <T> Future<T> submitToTargetInternal(Callable<T> task, Address address, T defaultValue, boolean preventSync) {
checkNotNull(task, "task should not be null");
String uuid = getUUID();
ClientMessage request = ExecutorServiceSubmitToAddressCodec.encodeRequest(name, uuid, toData(task), address);
ClientInvocationFuture f = invokeOnTarget(request, address);
return checkSync(f, uuid, address, preventSync, defaultValue);
}
use of com.hazelcast.client.spi.impl.ClientInvocationFuture in project hazelcast by hazelcast.
the class ClientExecutorServiceProxy method submitToKeyOwnerInternal.
private <T> Future<T> submitToKeyOwnerInternal(Callable<T> task, Object key, T defaultValue, boolean preventSync) {
checkNotNull(task, "task should not be null");
String uuid = getUUID();
int partitionId = getPartitionId(key);
ClientMessage request = ExecutorServiceSubmitToPartitionCodec.encodeRequest(name, uuid, toData(task), partitionId);
ClientInvocationFuture f = invokeOnPartitionOwner(request, partitionId);
return checkSync(f, uuid, partitionId, preventSync, defaultValue);
}
Aggregations