Search in sources :

Example 66 with Operation

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

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

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

the class AbstractReplicatedMapOperation method invoke.

private void invoke(boolean isRemove, OperationService operationService, Address address, String name, Data key, Data value, long ttl, VersionResponsePair response) {
    Operation op = new ReplicateUpdateOperation(name, key, value, ttl, response, isRemove, getCallerAddress()).setPartitionId(getPartitionId()).setValidateTarget(false);
    operationService.createInvocationBuilder(getServiceName(), op, address).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
Also used : Operation(com.hazelcast.spi.impl.operationservice.Operation)

Example 69 with Operation

use of com.hazelcast.spi.impl.operationservice.Operation 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)

Example 70 with Operation

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

the class RequestMapDataOperation method run.

@Override
public void run() throws Exception {
    ILogger logger = getLogger();
    Address callerAddress = getCallerAddress();
    int partitionId = getPartitionId();
    NodeEngine nodeEngine = getNodeEngine();
    if (logger.isFineEnabled()) {
        logger.fine("Caller " + callerAddress + " requested copy of replicated map '" + name + "' (partitionId " + partitionId + ") from " + nodeEngine.getThisAddress());
    }
    ReplicatedMapService service = getService();
    PartitionContainer container = service.getPartitionContainer(partitionId);
    ReplicatedRecordStore store = container.getOrCreateRecordStore(name);
    store.setLoaded(true);
    if (nodeEngine.getThisAddress().equals(callerAddress)) {
        return;
    }
    long version = store.getVersion();
    Set<RecordMigrationInfo> recordSet = getRecordSet(store);
    Operation op = new SyncReplicatedMapDataOperation(name, recordSet, version).setPartitionId(partitionId).setValidateTarget(false);
    OperationService operationService = nodeEngine.getOperationService();
    operationService.createInvocationBuilder(SERVICE_NAME, op, callerAddress).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
Also used : Address(com.hazelcast.cluster.Address) PartitionContainer(com.hazelcast.replicatedmap.impl.PartitionContainer) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) Operation(com.hazelcast.spi.impl.operationservice.Operation) RecordMigrationInfo(com.hazelcast.replicatedmap.impl.record.RecordMigrationInfo) NodeEngine(com.hazelcast.spi.impl.NodeEngine) ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ILogger(com.hazelcast.logging.ILogger) OperationService(com.hazelcast.spi.impl.operationservice.OperationService)

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