use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class CountDownLatchProxy method await.
@Override
public boolean await(long timeout, TimeUnit unit) throws InterruptedException {
checkNotNull(unit, "unit can't be null");
Operation op = new AwaitOperation(name, unit.toMillis(timeout)).setPartitionId(partitionId);
Future<Boolean> f = invokeOnPartition(op);
try {
return f.get();
} catch (ExecutionException e) {
throw rethrowAllowInterrupted(e);
}
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class CountDownLatchProxy method countDown.
@Override
public void countDown() {
Operation op = new CountDownOperation(name).setPartitionId(partitionId);
InternalCompletableFuture f = invokeOnPartition(op);
f.join();
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class AtomicReferenceProxy method applyAsync.
@Override
public <R> InternalCompletableFuture<R> applyAsync(IFunction<E, R> function) {
isNotNull(function, "function");
Operation operation = new ApplyOperation(name, toData(function)).setPartitionId(partitionId);
return invokeOnPartition(operation);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class SemaphoreProxy method availablePermits.
@Override
public int availablePermits() {
Operation operation = new AvailableOperation(name).setPartitionId(partitionId);
InternalCompletableFuture<Integer> future = invokeOnPartition(operation);
return future.join();
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class SemaphoreProxy method init.
@Override
public boolean init(int permits) {
checkNotNegative(permits, "permits can't be negative");
Operation operation = new InitOperation(name, permits).setPartitionId(partitionId);
InternalCompletableFuture<Boolean> future = invokeOnPartition(operation);
return future.join();
}
Aggregations