Search in sources :

Example 26 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 27 with OperationService

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

the class RingbufferProxy method readManyAsync.

@Override
public CompletionStage<ReadResultSet<E>> readManyAsync(long startSequence, int minCount, int maxCount, @Nullable IFunction<E, Boolean> filter) {
    checkSequence(startSequence);
    checkNotNegative(minCount, "minCount can't be smaller than 0");
    checkTrue(maxCount >= minCount, "maxCount should be equal or larger than minCount");
    checkTrue(maxCount <= config.getCapacity(), "the maxCount should be smaller than or equal to the capacity");
    checkTrue(maxCount <= MAX_BATCH_SIZE, "maxCount can't be larger than " + MAX_BATCH_SIZE);
    Operation op = new ReadManyOperation<>(name, startSequence, minCount, maxCount, filter).setPartitionId(partitionId);
    OperationService operationService = getOperationService();
    return operationService.createInvocationBuilder(null, op, partitionId).setCallTimeout(Long.MAX_VALUE).invoke();
}
Also used : AddAllOperation(com.hazelcast.ringbuffer.impl.operations.AddAllOperation) GenericOperation(com.hazelcast.ringbuffer.impl.operations.GenericOperation) ReadOneOperation(com.hazelcast.ringbuffer.impl.operations.ReadOneOperation) ReadManyOperation(com.hazelcast.ringbuffer.impl.operations.ReadManyOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) AddOperation(com.hazelcast.ringbuffer.impl.operations.AddOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 28 with OperationService

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

the class RingbufferProxy method addAllAsync.

@Override
public CompletionStage<Long> addAllAsync(@Nonnull Collection<? extends E> collection, @Nonnull OverflowPolicy overflowPolicy) {
    checkNotNull(collection, "collection can't be null");
    checkNotNull(overflowPolicy, "overflowPolicy can't be null");
    checkFalse(collection.isEmpty(), "collection can't be empty");
    checkTrue(collection.size() <= MAX_BATCH_SIZE, "collection can't be larger than " + MAX_BATCH_SIZE);
    Operation op = new AddAllOperation(name, toDataArray(collection), overflowPolicy).setPartitionId(partitionId);
    OperationService operationService = getOperationService();
    return operationService.createInvocationBuilder(null, op, partitionId).setCallTimeout(Long.MAX_VALUE).invoke();
}
Also used : AddAllOperation(com.hazelcast.ringbuffer.impl.operations.AddAllOperation) AddAllOperation(com.hazelcast.ringbuffer.impl.operations.AddAllOperation) GenericOperation(com.hazelcast.ringbuffer.impl.operations.GenericOperation) ReadOneOperation(com.hazelcast.ringbuffer.impl.operations.ReadOneOperation) ReadManyOperation(com.hazelcast.ringbuffer.impl.operations.ReadManyOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) AddOperation(com.hazelcast.ringbuffer.impl.operations.AddOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

Example 29 with OperationService

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

the class ReplicatedMapProxy method createPutAllOperationFuture.

private Future createPutAllOperationFuture(String name, MapEntries entrySet, int partitionId) {
    OperationService operationService = nodeEngine.getOperationService();
    Operation op = new PutAllOperation(name, entrySet);
    return operationService.invokeOnPartition(SERVICE_NAME, op, partitionId);
}
Also used : PutAllOperation(com.hazelcast.replicatedmap.impl.operation.PutAllOperation) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) PutAllOperation(com.hazelcast.replicatedmap.impl.operation.PutAllOperation) RequestMapDataOperation(com.hazelcast.replicatedmap.impl.operation.RequestMapDataOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation) RemoveOperation(com.hazelcast.replicatedmap.impl.operation.RemoveOperation) PutOperation(com.hazelcast.replicatedmap.impl.operation.PutOperation)

Example 30 with OperationService

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

the class CheckReplicaVersionOperation method requestDataFromOwner.

private void requestDataFromOwner(String name) {
    OperationService operationService = getNodeEngine().getOperationService();
    Operation op = new RequestMapDataOperation(name);
    operationService.createInvocationBuilder(SERVICE_NAME, op, getPartitionId()).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
Also used : OperationService(com.hazelcast.spi.impl.operationservice.OperationService) PartitionAwareOperation(com.hazelcast.spi.impl.operationservice.PartitionAwareOperation) Operation(com.hazelcast.spi.impl.operationservice.Operation)

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