use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientScheduledFutureProxy method isDone.
@Override
public boolean isDone() {
checkAccessibleHandler();
Address address = handler.getAddress();
String schedulerName = handler.getSchedulerName();
String taskName = handler.getTaskName();
int partitionId = handler.getPartitionId();
try {
if (address != null) {
ClientMessage request = ScheduledExecutorIsDoneFromAddressCodec.encodeRequest(schedulerName, taskName, address);
ClientMessage response = new ClientInvocation(getClient(), request, address).invoke().get();
return ScheduledExecutorIsDoneFromAddressCodec.decodeResponse(response).response;
} else {
ClientMessage request = ScheduledExecutorIsDoneFromPartitionCodec.encodeRequest(schedulerName, taskName);
ClientMessage response = new ClientInvocation(getClient(), request, partitionId).invoke().get();
return ScheduledExecutorIsDoneFromPartitionCodec.decodeResponse(response).response;
}
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientScheduledFutureProxy method get0.
private V get0(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
checkAccessibleHandler();
Address address = handler.getAddress();
String schedulerName = handler.getSchedulerName();
String taskName = handler.getTaskName();
int partitionId = handler.getPartitionId();
if (address != null) {
ClientMessage request = ScheduledExecutorGetResultFromAddressCodec.encodeRequest(schedulerName, taskName, address);
ClientMessage response = new ClientInvocation(getClient(), request, address).invoke().get(timeout, unit);
Data data = ScheduledExecutorGetResultFromAddressCodec.decodeResponse(response).response;
return getSerializationService().toObject(data);
} else {
ClientMessage request = ScheduledExecutorGetResultFromPartitionCodec.encodeRequest(schedulerName, taskName);
ClientMessage response = new ClientInvocation(getClient(), request, partitionId).invoke().get(timeout, unit);
Data data = ScheduledExecutorGetResultFromPartitionCodec.decodeResponse(response).response;
return getSerializationService().toObject(data);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientScheduledFutureProxy method dispose.
public void dispose() {
checkAccessibleHandler();
Address address = handler.getAddress();
String schedulerName = handler.getSchedulerName();
String taskName = handler.getTaskName();
int partitionId = handler.getPartitionId();
try {
if (address != null) {
ClientMessage request = ScheduledExecutorDisposeFromAddressCodec.encodeRequest(schedulerName, taskName, address);
new ClientInvocation(getClient(), request, address).invoke().get();
} else {
ClientMessage request = ScheduledExecutorDisposeFromPartitionCodec.encodeRequest(schedulerName, taskName);
new ClientInvocation(getClient(), request, partitionId).invoke().get();
}
handler = null;
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class ClientTxnProxy method invoke.
final ClientMessage invoke(ClientMessage request) {
try {
HazelcastClientInstanceImpl client = transactionContext.getClient();
ClientConnection connection = transactionContext.getConnection();
ClientInvocation invocation = new ClientInvocation(client, request, connection);
Future<ClientMessage> future = invocation.invoke();
return future.get();
} catch (Exception e) {
throw ExceptionUtil.rethrow(e);
}
}
use of com.hazelcast.client.spi.impl.ClientInvocation in project hazelcast by hazelcast.
the class AbstractClientInternalCacheProxy method invoke.
protected ClientInvocationFuture invoke(ClientMessage req, int partitionId, int completionId) {
boolean completionOperation = completionId != -1;
if (completionOperation) {
registerCompletionLatch(completionId, 1);
}
try {
HazelcastClientInstanceImpl client = (HazelcastClientInstanceImpl) clientContext.getHazelcastInstance();
ClientInvocation clientInvocation = new ClientInvocation(client, req, partitionId);
ClientInvocationFuture f = clientInvocation.invoke();
if (completionOperation) {
waitCompletionLatch(completionId, f);
}
return f;
} catch (Throwable e) {
if (e instanceof IllegalStateException) {
close();
}
if (completionOperation) {
deregisterCompletionLatch(completionId);
}
throw rethrowAllowedTypeFirst(e, CacheException.class);
}
}
Aggregations