Search in sources :

Example 56 with OperationService

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

the class PartitionReplicaSyncRequest method sendResponse.

/**
 * Send a synchronization response to the caller replica containing the replication operations to be executed
 */
private void sendResponse(Collection<Operation> operations, Collection<ChunkSupplier> chunkSuppliers, ServiceNamespace ns) {
    NodeEngine nodeEngine = getNodeEngine();
    PartitionReplicaSyncResponse syncResponse = createResponse(operations, chunkSuppliers, ns);
    Address target = getCallerAddress();
    ILogger logger = getLogger();
    if (logger.isFinestEnabled()) {
        logger.finest("Sending sync response to -> " + target + " for partitionId=" + partitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns);
    }
    // PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system.
    syncResponse.setTarget(target);
    OperationService operationService = nodeEngine.getOperationService();
    operationService.send(syncResponse, target);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) Address(com.hazelcast.cluster.Address) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 57 with OperationService

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

the class PublisherCreateOperation method readAndResetAccumulator.

/**
 * Read and reset the accumulator of query cache inside the given partition.
 */
private Future<Object> readAndResetAccumulator(String mapName, String cacheId, Integer partitionId) {
    Operation operation = new ReadAndResetAccumulatorOperation(mapName, cacheId);
    OperationService operationService = getNodeEngine().getOperationService();
    return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation) AbstractNamedOperation(com.hazelcast.spi.impl.operationservice.AbstractNamedOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 58 with OperationService

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

the class BasicRecordStoreLoader method sendOperation.

/**
 * Invokes an operation to put the provided key-value pairs to the partition
 * record store.
 *
 * @param loadingSequence the list of serialised key-value-(expirationTime)
 *                        sequences
 * @return the future representing the pending completion of the put operation
 */
private Future<?> sendOperation(List<Data> loadingSequence) {
    OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
    NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    Operation operation = createOperation(loadingSequence);
    operation.setNodeEngine(nodeEngine);
    operation.setPartitionId(partitionId);
    OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
    operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
    operation.setServiceName(MapService.SERVICE_NAME);
    return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) Operation(com.hazelcast.spi.impl.operationservice.Operation) RemoveFromLoadAllOperation(com.hazelcast.map.impl.operation.RemoveFromLoadAllOperation)

Example 59 with OperationService

use of com.hazelcast.spi.impl.operationservice.OperationService 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 60 with OperationService

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

the class QueueService method rollbackTransaction.

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

Aggregations

OperationService (com.hazelcast.spi.impl.operationservice.OperationService)140 Operation (com.hazelcast.spi.impl.operationservice.Operation)55 Test (org.junit.Test)54 HazelcastInstance (com.hazelcast.core.HazelcastInstance)46 QuickTest (com.hazelcast.test.annotation.QuickTest)41 Accessors.getOperationService (com.hazelcast.test.Accessors.getOperationService)40 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)40 Address (com.hazelcast.cluster.Address)31 NodeEngine (com.hazelcast.spi.impl.NodeEngine)31 InternalCompletableFuture (com.hazelcast.spi.impl.InternalCompletableFuture)24 Future (java.util.concurrent.Future)24 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)23 Config (com.hazelcast.config.Config)22 Member (com.hazelcast.cluster.Member)21 Data (com.hazelcast.internal.serialization.Data)12 SlowTest (com.hazelcast.test.annotation.SlowTest)12 ClusterService (com.hazelcast.internal.cluster.ClusterService)9 ILogger (com.hazelcast.logging.ILogger)7 ArrayList (java.util.ArrayList)7 IPartitionService (com.hazelcast.internal.partition.IPartitionService)6