use of com.hazelcast.client.impl.protocol.codec.DurableExecutorRetrieveResultCodec in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceProxy method submitToPartition.
private <T> DurableExecutorServiceFuture<T> submitToPartition(@Nonnull Callable<T> task, int partitionId, @Nullable T result) {
checkNotNull(task, "task should not be null");
ClientMessage request = DurableExecutorSubmitToPartitionCodec.encodeRequest(name, toData(task));
int sequence;
try {
ClientMessage response = invokeOnPartition(request, partitionId);
sequence = DurableExecutorSubmitToPartitionCodec.decodeResponse(response);
} catch (Throwable t) {
return completedExceptionally(t, ConcurrencyUtil.getDefaultAsyncExecutor());
}
ClientMessage clientMessage = DurableExecutorRetrieveResultCodec.encodeRequest(name, sequence);
ClientInvocationFuture future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke();
long taskId = Bits.combineToLong(partitionId, sequence);
return new ClientDurableExecutorServiceDelegatingFuture<>(future, getSerializationService(), DurableExecutorRetrieveResultCodec::decodeResponse, result, taskId);
}
use of com.hazelcast.client.impl.protocol.codec.DurableExecutorRetrieveResultCodec in project hazelcast by hazelcast.
the class ClientDurableExecutorServiceProxy method retrieveAndDisposeResult.
@Override
public <T> Future<T> retrieveAndDisposeResult(long taskId) {
int partitionId = Bits.extractInt(taskId, false);
int sequence = Bits.extractInt(taskId, true);
ClientMessage clientMessage = DurableExecutorRetrieveAndDisposeResultCodec.encodeRequest(name, sequence);
ClientInvocationFuture future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke();
return new ClientDelegatingFuture<>(future, getSerializationService(), DurableExecutorRetrieveResultCodec::decodeResponse);
}
use of com.hazelcast.client.impl.protocol.codec.DurableExecutorRetrieveResultCodec 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, getName(), partitionId).invoke();
return new ClientDelegatingFuture<>(future, getSerializationService(), DurableExecutorRetrieveResultCodec::decodeResponse);
}
Aggregations