use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.
the class AbstractExecutorServiceCancelMessageTask method call.
@Override
protected Object call() throws Exception {
InvocationBuilder builder = createInvocationBuilder();
builder.setTryCount(CANCEL_TRY_COUNT).setTryPauseMillis(CANCEL_TRY_PAUSE_MILLIS);
InternalCompletableFuture future = builder.invoke();
boolean result = false;
try {
result = (Boolean) future.get();
} catch (InterruptedException e) {
logException(e);
} catch (ExecutionException e) {
logException(e);
}
return result;
}
use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.
the class ConditionImpl method beforeAwait.
private void beforeAwait(long threadId) {
Data key = lockProxy.getKeyData();
BeforeAwaitOperation op = new BeforeAwaitOperation(namespace, key, threadId, conditionId);
InternalCompletableFuture f = invoke(op);
f.join();
}
use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.
the class SemaphoreProxy method release.
@Override
public void release(int permits) {
checkNotNegative(permits, "permits can't be negative");
Operation operation = new ReleaseOperation(name, permits).setPartitionId(partitionId);
InternalCompletableFuture future = invokeOnPartition(operation);
future.join();
}
use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.
the class ExecutorServiceProxy method submitToPartitionOwner.
private <T> Future<T> submitToPartitionOwner(Callable<T> task, int partitionId, boolean preventSync) {
checkNotNull(task, "task can't be null");
checkNotShutdown();
NodeEngine nodeEngine = getNodeEngine();
Data taskData = nodeEngine.toData(task);
String uuid = newUnsecureUuidString();
boolean sync = !preventSync && checkSync();
Operation op = new CallableTaskOperation(name, uuid, taskData).setPartitionId(partitionId);
InternalCompletableFuture future = invokeOnPartition(op);
if (sync) {
Object response;
try {
response = future.get();
} catch (Exception e) {
response = e;
}
return new CompletedFuture<T>(nodeEngine.getSerializationService(), response, getAsyncExecutor());
}
return new CancellableDelegatingFuture<T>(future, nodeEngine, uuid, partitionId);
}
use of com.hazelcast.spi.InternalCompletableFuture in project hazelcast by hazelcast.
the class ClientMapMetaDataFetcher method scanMembers.
@Override
protected List<InternalCompletableFuture> scanMembers(List<String> names) {
Collection<Member> members = clusterService.getMembers(DATA_MEMBER_SELECTOR);
List<InternalCompletableFuture> futures = new ArrayList<InternalCompletableFuture>(members.size());
for (Member member : members) {
Address address = member.getAddress();
ClientMessage message = encodeRequest(names, address);
ClientInvocation invocation = new ClientInvocation(clientImpl, message, address);
try {
futures.add(invocation.invoke());
} catch (Exception e) {
if (logger.isWarningEnabled()) {
logger.warning("Cant fetch invalidation meta-data from address + " + address + " + [" + e.getMessage() + "]");
}
}
}
return futures;
}
Aggregations