Search in sources :

Example 81 with Operation

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);
    }
}
Also used : AwaitOperation(com.hazelcast.concurrent.countdownlatch.operations.AwaitOperation) CountDownOperation(com.hazelcast.concurrent.countdownlatch.operations.CountDownOperation) Operation(com.hazelcast.spi.Operation) GetCountOperation(com.hazelcast.concurrent.countdownlatch.operations.GetCountOperation) AwaitOperation(com.hazelcast.concurrent.countdownlatch.operations.AwaitOperation) SetCountOperation(com.hazelcast.concurrent.countdownlatch.operations.SetCountOperation) ExecutionException(java.util.concurrent.ExecutionException)

Example 82 with Operation

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();
}
Also used : CountDownOperation(com.hazelcast.concurrent.countdownlatch.operations.CountDownOperation) InternalCompletableFuture(com.hazelcast.spi.InternalCompletableFuture) CountDownOperation(com.hazelcast.concurrent.countdownlatch.operations.CountDownOperation) Operation(com.hazelcast.spi.Operation) GetCountOperation(com.hazelcast.concurrent.countdownlatch.operations.GetCountOperation) AwaitOperation(com.hazelcast.concurrent.countdownlatch.operations.AwaitOperation) SetCountOperation(com.hazelcast.concurrent.countdownlatch.operations.SetCountOperation)

Example 83 with Operation

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);
}
Also used : ApplyOperation(com.hazelcast.concurrent.atomicreference.operations.ApplyOperation) IsNullOperation(com.hazelcast.concurrent.atomicreference.operations.IsNullOperation) SetAndGetOperation(com.hazelcast.concurrent.atomicreference.operations.SetAndGetOperation) GetAndSetOperation(com.hazelcast.concurrent.atomicreference.operations.GetAndSetOperation) GetAndAlterOperation(com.hazelcast.concurrent.atomicreference.operations.GetAndAlterOperation) Operation(com.hazelcast.spi.Operation) GetOperation(com.hazelcast.concurrent.atomicreference.operations.GetOperation) SetOperation(com.hazelcast.concurrent.atomicreference.operations.SetOperation) AlterAndGetOperation(com.hazelcast.concurrent.atomicreference.operations.AlterAndGetOperation) CompareAndSetOperation(com.hazelcast.concurrent.atomicreference.operations.CompareAndSetOperation) AlterOperation(com.hazelcast.concurrent.atomicreference.operations.AlterOperation) ApplyOperation(com.hazelcast.concurrent.atomicreference.operations.ApplyOperation) ContainsOperation(com.hazelcast.concurrent.atomicreference.operations.ContainsOperation)

Example 84 with 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();
}
Also used : AvailableOperation(com.hazelcast.concurrent.semaphore.operations.AvailableOperation) Operation(com.hazelcast.spi.Operation) AvailableOperation(com.hazelcast.concurrent.semaphore.operations.AvailableOperation) ReduceOperation(com.hazelcast.concurrent.semaphore.operations.ReduceOperation) AcquireOperation(com.hazelcast.concurrent.semaphore.operations.AcquireOperation) DrainOperation(com.hazelcast.concurrent.semaphore.operations.DrainOperation) ReleaseOperation(com.hazelcast.concurrent.semaphore.operations.ReleaseOperation) InitOperation(com.hazelcast.concurrent.semaphore.operations.InitOperation)

Example 85 with Operation

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();
}
Also used : InitOperation(com.hazelcast.concurrent.semaphore.operations.InitOperation) Operation(com.hazelcast.spi.Operation) AvailableOperation(com.hazelcast.concurrent.semaphore.operations.AvailableOperation) ReduceOperation(com.hazelcast.concurrent.semaphore.operations.ReduceOperation) AcquireOperation(com.hazelcast.concurrent.semaphore.operations.AcquireOperation) DrainOperation(com.hazelcast.concurrent.semaphore.operations.DrainOperation) ReleaseOperation(com.hazelcast.concurrent.semaphore.operations.ReleaseOperation) InitOperation(com.hazelcast.concurrent.semaphore.operations.InitOperation)

Aggregations

Operation (com.hazelcast.spi.Operation)94 OperationService (com.hazelcast.spi.OperationService)14 Member (com.hazelcast.core.Member)13 Address (com.hazelcast.nio.Address)11 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)8 ArrayList (java.util.ArrayList)8 ILogger (com.hazelcast.logging.ILogger)7 UrgentSystemOperation (com.hazelcast.spi.UrgentSystemOperation)7 ParallelTest (com.hazelcast.test.annotation.ParallelTest)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 Test (org.junit.Test)7 AcquireOperation (com.hazelcast.concurrent.semaphore.operations.AcquireOperation)6 AvailableOperation (com.hazelcast.concurrent.semaphore.operations.AvailableOperation)6 DrainOperation (com.hazelcast.concurrent.semaphore.operations.DrainOperation)6 InitOperation (com.hazelcast.concurrent.semaphore.operations.InitOperation)6 ReduceOperation (com.hazelcast.concurrent.semaphore.operations.ReduceOperation)6 ReleaseOperation (com.hazelcast.concurrent.semaphore.operations.ReleaseOperation)6 MemberInfo (com.hazelcast.internal.cluster.MemberInfo)6 NodeEngine (com.hazelcast.spi.NodeEngine)6 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)6