use of com.hazelcast.spi.Operation 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.Operation in project hazelcast by hazelcast.
the class CountDownLatchProxy method trySetCount.
@Override
public boolean trySetCount(int count) {
checkNotNegative(count, "count can't be negative");
Operation op = new SetCountOperation(name, count).setPartitionId(partitionId);
InternalCompletableFuture<Boolean> f = invokeOnPartition(op);
return f.join();
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class DistributedExecutorService method populate.
@Override
public void populate(LiveOperations liveOperations) {
for (CallableProcessor processor : submittedTasks.values()) {
Operation op = processor.op;
liveOperations.add(op.getCallerAddress(), op.getCallId());
}
}
use of com.hazelcast.spi.Operation 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.Operation in project hazelcast by hazelcast.
the class DurableExecutorServiceProxy method disposeResult.
@Override
public void disposeResult(long uniqueId) {
int partitionId = Bits.extractInt(uniqueId, false);
int sequence = Bits.extractInt(uniqueId, true);
Operation op = new DisposeResultOperation(name, sequence).setPartitionId(partitionId);
InternalCompletableFuture<?> future = invokeOnPartition(op);
future.join();
}
Aggregations