Search in sources :

Example 36 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class ScheduledFutureProxy method isCancelled.

@Override
public boolean isCancelled() {
    checkAccessibleHandler();
    checkAccessibleOwner();
    Operation op = new IsCanceledOperation(handler);
    return this.<Boolean>invoke(op).joinInternal();
}
Also used : IsCanceledOperation(com.hazelcast.scheduledexecutor.impl.operations.IsCanceledOperation) DisposeTaskOperation(com.hazelcast.scheduledexecutor.impl.operations.DisposeTaskOperation) GetResultOperation(com.hazelcast.scheduledexecutor.impl.operations.GetResultOperation) IsCanceledOperation(com.hazelcast.scheduledexecutor.impl.operations.IsCanceledOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) CancelTaskOperation(com.hazelcast.scheduledexecutor.impl.operations.CancelTaskOperation) GetStatisticsOperation(com.hazelcast.scheduledexecutor.impl.operations.GetStatisticsOperation) GetDelayOperation(com.hazelcast.scheduledexecutor.impl.operations.GetDelayOperation) IsDoneOperation(com.hazelcast.scheduledexecutor.impl.operations.IsDoneOperation)

Example 37 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class ScheduledFutureProxy method get0.

private InvocationFuture<V> get0() {
    checkAccessibleHandler();
    checkAccessibleOwner();
    Operation op = new GetResultOperation<V>(handler);
    return this.invoke(op);
}
Also used : GetResultOperation(com.hazelcast.scheduledexecutor.impl.operations.GetResultOperation) DisposeTaskOperation(com.hazelcast.scheduledexecutor.impl.operations.DisposeTaskOperation) GetResultOperation(com.hazelcast.scheduledexecutor.impl.operations.GetResultOperation) IsCanceledOperation(com.hazelcast.scheduledexecutor.impl.operations.IsCanceledOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) CancelTaskOperation(com.hazelcast.scheduledexecutor.impl.operations.CancelTaskOperation) GetStatisticsOperation(com.hazelcast.scheduledexecutor.impl.operations.GetStatisticsOperation) GetDelayOperation(com.hazelcast.scheduledexecutor.impl.operations.GetDelayOperation) IsDoneOperation(com.hazelcast.scheduledexecutor.impl.operations.IsDoneOperation)

Example 38 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class WaitSet method unpark.

// Runs in partition-thread, and therefor we can assume we have exclusive access to the WaitNotifyKey
// (since each WaitNotifyKey is mapped to a single partition). So a park will not be concurrently
// executed with an unpark for the same key.
public void unpark(Notifier notifier, WaitNotifyKey key) {
    WaitSetEntry entry = queue.peek();
    while (entry != null) {
        Operation op = entry.getOperation();
        if (notifier == op) {
            throw new IllegalStateException("Found cyclic wait-notify! -> " + notifier);
        }
        if (entry.isValid()) {
            if (entry.isExpired()) {
                // expired
                entry.onExpire();
            } else if (entry.isCancelled()) {
                entry.onCancel();
            } else {
                if (entry.shouldWait()) {
                    return;
                }
                OperationService operationService = nodeEngine.getOperationService();
                operationService.run(op);
            }
            entry.setValid(false);
        }
        // consume
        queue.poll();
        entry = queue.peek();
        // We can safely remove this queue from registration map here.
        if (entry == null) {
            waitSetMap.remove(key);
        }
    }
}
Also used : BlockingOperation(com.hazelcast.spi.impl.operationservice.BlockingOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 39 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class TotalOrderedTopicProxy method publishAllAsync.

@Override
public InternalCompletableFuture<Void> publishAllAsync(@Nonnull Collection<? extends E> messages) {
    checkNotNull(messages, NULL_MESSAGE_IS_NOT_ALLOWED);
    checkNoNullInside(messages, NULL_MESSAGE_IS_NOT_ALLOWED);
    Operation op = new PublishAllOperation(getName(), toDataArray(messages));
    return publishInternalAsync(op);
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation)

Example 40 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation in project hazelcast by hazelcast.

the class TotalOrderedTopicProxy method publishAsync.

@Override
public InternalCompletableFuture<Void> publishAsync(@Nonnull E message) {
    checkNotNull(message, NULL_MESSAGE_IS_NOT_ALLOWED);
    Operation op = new PublishOperation(getName(), toData(message));
    return publishInternalAsync(op);
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation)

Aggregations

Operation (com.hazelcast.spi.impl.operationservice.Operation)271 Test (org.junit.Test)80 QuickTest (com.hazelcast.test.annotation.QuickTest)79 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)59 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)56 Address (com.hazelcast.cluster.Address)31 HazelcastInstance (com.hazelcast.core.HazelcastInstance)25 Data (com.hazelcast.internal.serialization.Data)24 Future (java.util.concurrent.Future)24 Member (com.hazelcast.cluster.Member)22 ArrayList (java.util.ArrayList)21 NodeEngine (com.hazelcast.spi.impl.NodeEngine)18 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)17 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)17 AssertTask (com.hazelcast.test.AssertTask)15 ILogger (com.hazelcast.logging.ILogger)14 UrgentSystemOperation (com.hazelcast.spi.impl.operationservice.UrgentSystemOperation)13 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)13 Config (com.hazelcast.config.Config)12 CompletableFuture (java.util.concurrent.CompletableFuture)12