Search in sources :

Example 11 with Operation

use of com.hazelcast.spi.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 : BackupAwareOperation(com.hazelcast.spi.BackupAwareOperation) Operation(com.hazelcast.spi.Operation) CollectionTxnOperation(com.hazelcast.collection.impl.txncollection.CollectionTxnOperation)

Example 12 with Operation

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

the class CollectionService method rollbackTransaction.

@Override
public void rollbackTransaction(String transactionId) {
    final Set<String> collectionNames = getContainerMap().keySet();
    IPartitionService partitionService = nodeEngine.getPartitionService();
    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.execute(operation);
    }
}
Also used : CollectionTransactionRollbackOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTransactionRollbackOperation) IPartitionService(com.hazelcast.spi.partition.IPartitionService) OperationService(com.hazelcast.spi.OperationService) CollectionTransactionRollbackOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTransactionRollbackOperation) Operation(com.hazelcast.spi.Operation) MigrationEndpoint(com.hazelcast.spi.partition.MigrationEndpoint)

Example 13 with Operation

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

the class AtomicReferenceProxy method alterAndGetAsync.

@Override
public InternalCompletableFuture<E> alterAndGetAsync(IFunction<E, E> function) {
    isNotNull(function, "function");
    Operation operation = new AlterAndGetOperation(name, toData(function)).setPartitionId(partitionId);
    return invokeOnPartition(operation);
}
Also used : AlterAndGetOperation(com.hazelcast.concurrent.atomicreference.operations.AlterAndGetOperation) 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 14 with Operation

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

the class AtomicReferenceProxy method getAndAlterAsync.

@Override
public InternalCompletableFuture<E> getAndAlterAsync(IFunction<E, E> function) {
    isNotNull(function, "function");
    Operation operation = new GetAndAlterOperation(name, toData(function)).setPartitionId(partitionId);
    return invokeOnPartition(operation);
}
Also used : GetAndAlterOperation(com.hazelcast.concurrent.atomicreference.operations.GetAndAlterOperation) 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 15 with Operation

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

the class AtomicReferenceProxy method alterAsync.

@Override
public InternalCompletableFuture<Void> alterAsync(IFunction<E, E> function) {
    isNotNull(function, "function");
    Operation operation = new AlterOperation(name, toData(function)).setPartitionId(partitionId);
    return invokeOnPartition(operation);
}
Also used : GetAndAlterOperation(com.hazelcast.concurrent.atomicreference.operations.GetAndAlterOperation) AlterOperation(com.hazelcast.concurrent.atomicreference.operations.AlterOperation) 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)

Aggregations

Operation (com.hazelcast.spi.Operation)216 QuickTest (com.hazelcast.test.annotation.QuickTest)60 Test (org.junit.Test)60 OperationService (com.hazelcast.spi.OperationService)39 ParallelTest (com.hazelcast.test.annotation.ParallelTest)39 Future (java.util.concurrent.Future)19 Member (com.hazelcast.core.Member)18 Address (com.hazelcast.nio.Address)18 Data (com.hazelcast.nio.serialization.Data)18 HazelcastInstance (com.hazelcast.core.HazelcastInstance)17 AssertTask (com.hazelcast.test.AssertTask)17 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)15 ArrayList (java.util.ArrayList)15 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)14 NodeEngine (com.hazelcast.spi.NodeEngine)14 BackupAwareOperation (com.hazelcast.spi.BackupAwareOperation)13 BlockingOperation (com.hazelcast.spi.BlockingOperation)13 MapOperation (com.hazelcast.map.impl.operation.MapOperation)12 AtomicReference (java.util.concurrent.atomic.AtomicReference)11 Config (com.hazelcast.config.Config)10