Search in sources :

Example 31 with MapOperationProvider

use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.

the class MapTryRemoveMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation operation = operationProvider.createTryRemoveOperation(parameters.name, parameters.key, parameters.timeout);
    operation.setThreadId(parameters.threadId);
    return operation;
}
Also used : MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 32 with MapOperationProvider

use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.

the class MapSetWithMaxIdleMessageTask method prepareOperation.

protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation op = operationProvider.createSetOperation(parameters.name, parameters.key, parameters.value, parameters.ttl, parameters.maxIdle);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 33 with MapOperationProvider

use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.

the class MapSubmitToKeyMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    EntryProcessor processor = serializationService.toObject(parameters.entryProcessor);
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation op = operationProvider.createEntryOperation(parameters.name, parameters.key, processor);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : EntryProcessor(com.hazelcast.map.EntryProcessor) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 34 with MapOperationProvider

use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.

the class MapTryPutMessageTask method prepareOperation.

@Override
protected Operation prepareOperation() {
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    MapOperation op = operationProvider.createTryPutOperation(parameters.name, parameters.key, parameters.value, parameters.timeout);
    op.setThreadId(parameters.threadId);
    return op;
}
Also used : MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 35 with MapOperationProvider

use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.

the class AbstractWanCustomPublisherMapTest method runMergeOpForWAN.

private void runMergeOpForWAN(boolean enableWANReplicationEvent) {
    // init hazelcast instances
    String mapName = "merge_operation_generates_wan_replication_event";
    initInstancesAndMap(mapName);
    // get internal services to use in this test
    HazelcastInstance node = instance1;
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(node);
    InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
    OperationServiceImpl operationService = nodeEngineImpl.getOperationService();
    SerializationService serializationService = nodeEngineImpl.getSerializationService();
    MapService mapService = nodeEngineImpl.getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(mapName);
    // prepare and send one merge operation
    Data data = serializationService.toData(1);
    MapOperation op;
    SimpleEntryView<Data, Data> entryView = new SimpleEntryView<Data, Data>().withKey(data).withValue(data);
    MapMergeTypes<Object, Object> mergingEntry = createMergingEntry(serializationService, entryView);
    SplitBrainMergePolicy<Object, MapMergeTypes<Object, Object>, Object> mergePolicy = new com.hazelcast.spi.merge.PassThroughMergePolicy<>();
    op = operationProvider.createMergeOperation(mapName, mergingEntry, mergePolicy, !enableWANReplicationEvent);
    operationService.createInvocationBuilder(MapService.SERVICE_NAME, op, partitionService.getPartitionId(data)).invoke();
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data) MapMergeTypes(com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapOperation(com.hazelcast.map.impl.operation.MapOperation) HazelcastInstance(com.hazelcast.core.HazelcastInstance) SimpleEntryView(com.hazelcast.map.impl.SimpleEntryView) MapService(com.hazelcast.map.impl.MapService) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl)

Aggregations

MapOperationProvider (com.hazelcast.map.impl.operation.MapOperationProvider)35 MapOperation (com.hazelcast.map.impl.operation.MapOperation)25 EntryProcessor (com.hazelcast.map.EntryProcessor)6 Future (java.util.concurrent.Future)4 IterationPointer (com.hazelcast.internal.iteration.IterationPointer)3 Data (com.hazelcast.internal.serialization.Data)3 Predicate (com.hazelcast.query.Predicate)3 SerializationService (com.hazelcast.internal.serialization.SerializationService)2 MapMergeTypes (com.hazelcast.spi.merge.SplitBrainMergeTypes.MapMergeTypes)2 EntryView (com.hazelcast.core.EntryView)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1 MapEntries (com.hazelcast.map.impl.MapEntries)1 MapService (com.hazelcast.map.impl.MapService)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 SimpleEntryView (com.hazelcast.map.impl.SimpleEntryView)1 RemoveFromLoadAllOperation (com.hazelcast.map.impl.operation.RemoveFromLoadAllOperation)1 Query (com.hazelcast.map.impl.query.Query)1 MapMergePolicy (com.hazelcast.map.merge.MapMergePolicy)1 Data (com.hazelcast.nio.serialization.Data)1