Search in sources :

Example 1 with Operation

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

the class CardinalityEstimatorProxy method addAsync.

@Override
public InvocationFuture<Void> addAsync(@Nonnull Object obj) {
    checkNotNull(obj, "Object must not be null");
    Data data = getNodeEngine().getSerializationService().toData(obj);
    Operation operation = new AggregateOperation(name, data.hash64()).setPartitionId(partitionId);
    return invokeOnPartition(operation);
}
Also used : Data(com.hazelcast.internal.serialization.Data) Operation(com.hazelcast.spi.impl.operationservice.Operation) AggregateOperation(com.hazelcast.cardinality.impl.operations.AggregateOperation) EstimateOperation(com.hazelcast.cardinality.impl.operations.EstimateOperation) AggregateOperation(com.hazelcast.cardinality.impl.operations.AggregateOperation)

Example 2 with Operation

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

the class CollectionTxnUtil method before.

public static void before(List<Operation> operationList, Operation wrapper) throws Exception {
    for (Operation operation : operationList) {
        operation.setService(wrapper.getService());
        operation.setServiceName(wrapper.getServiceName());
        operation.setCallerUuid(wrapper.getCallerUuid());
        operation.setNodeEngine(wrapper.getNodeEngine());
        operation.setPartitionId(wrapper.getPartitionId());
        operation.beforeRun();
    }
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation) BackupAwareOperation(com.hazelcast.spi.impl.operationservice.BackupAwareOperation) CollectionTxnOperation(com.hazelcast.collection.impl.txncollection.CollectionTxnOperation)

Example 3 with Operation

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

the class CollectionService method rollbackTransaction.

@Override
public void rollbackTransaction(UUID transactionId) {
    final Set<String> collectionNames = getContainerMap().keySet();
    OperationService operationService = nodeEngine.getOperationService();
    for (String name : collectionNames) {
        int partitionId = partitionService.getPartitionId(StringPartitioningStrategy.getPartitionKey(name));
        Operation operation = new CollectionTransactionRollbackOperation(name, transactionId).setPartitionId(partitionId).setService(this).setNodeEngine(nodeEngine);
        operationService.invokeOnPartition(operation);
    }
}
Also used : CollectionTransactionRollbackOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTransactionRollbackOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) CollectionOperation(com.hazelcast.collection.impl.collection.operations.CollectionOperation) CollectionMergeOperation(com.hazelcast.collection.impl.collection.operations.CollectionMergeOperation) CollectionTransactionRollbackOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTransactionRollbackOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) MigrationEndpoint(com.hazelcast.internal.partition.MigrationEndpoint)

Example 4 with Operation

use of com.hazelcast.spi.impl.operationservice.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.joinInternal();
}
Also used : DisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.DisposeResultOperation) RetrieveAndDisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.RetrieveAndDisposeResultOperation) ShutdownOperation(com.hazelcast.durableexecutor.impl.operations.ShutdownOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) TaskOperation(com.hazelcast.durableexecutor.impl.operations.TaskOperation) DisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.DisposeResultOperation) RetrieveAndDisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.RetrieveAndDisposeResultOperation) RetrieveResultOperation(com.hazelcast.durableexecutor.impl.operations.RetrieveResultOperation)

Example 5 with Operation

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

the class DurableExecutorServiceProxy method retrieveAndDisposeResult.

@Override
public <T> Future<T> retrieveAndDisposeResult(long uniqueId) {
    int partitionId = Bits.extractInt(uniqueId, false);
    int sequence = Bits.extractInt(uniqueId, true);
    Operation op = new RetrieveAndDisposeResultOperation(name, sequence).setPartitionId(partitionId);
    return invokeOnPartition(op);
}
Also used : ShutdownOperation(com.hazelcast.durableexecutor.impl.operations.ShutdownOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) TaskOperation(com.hazelcast.durableexecutor.impl.operations.TaskOperation) DisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.DisposeResultOperation) RetrieveAndDisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.RetrieveAndDisposeResultOperation) RetrieveResultOperation(com.hazelcast.durableexecutor.impl.operations.RetrieveResultOperation) RetrieveAndDisposeResultOperation(com.hazelcast.durableexecutor.impl.operations.RetrieveAndDisposeResultOperation)

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