Search in sources :

Example 1 with MapOperationProvider

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

the class MapReplicationSupportingService method handleRemove.

private void handleRemove(MapReplicationRemove replicationRemove) {
    String mapName = replicationRemove.getMapName();
    MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(mapName);
    MapOperation operation = operationProvider.createRemoveOperation(replicationRemove.getMapName(), replicationRemove.getKey(), true);
    try {
        int partitionId = nodeEngine.getPartitionService().getPartitionId(replicationRemove.getKey());
        Future f = nodeEngine.getOperationService().invokeOnPartition(SERVICE_NAME, operation, partitionId);
        f.get();
    } catch (Throwable t) {
        throw ExceptionUtil.rethrow(t);
    }
}
Also used : Future(java.util.concurrent.Future) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 2 with MapOperationProvider

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

the class BasicRecordStoreLoader method createOperation.

private Operation createOperation(List<Data> keyValueSequence, final AtomicInteger finishedBatchCounter) {
    final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
    MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(name);
    MapOperation operation = operationProvider.createPutFromLoadAllOperation(name, keyValueSequence);
    operation.setNodeEngine(nodeEngine);
    operation.setOperationResponseHandler(new OperationResponseHandler() {

        @Override
        public void sendResponse(Operation op, Object obj) {
            if (finishedBatchCounter.decrementAndGet() == 0) {
                loaded.set(true);
            }
        }
    });
    operation.setPartitionId(partitionId);
    OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
    operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
    operation.setServiceName(MapService.SERVICE_NAME);
    return operation;
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) MapOperation(com.hazelcast.map.impl.operation.MapOperation) Operation(com.hazelcast.spi.Operation) RemoveFromLoadAllOperation(com.hazelcast.map.impl.operation.RemoveFromLoadAllOperation) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) OperationResponseHandler(com.hazelcast.spi.OperationResponseHandler) MapOperation(com.hazelcast.map.impl.operation.MapOperation)

Example 3 with MapOperationProvider

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

the class MapExecuteWithPredicateMessageTask method createOperationFactory.

@Override
protected OperationFactory createOperationFactory() {
    MapOperationProvider operationProvider = getOperationProvider(parameters.name);
    EntryProcessor entryProcessor = serializationService.toObject(parameters.entryProcessor);
    Predicate predicate = serializationService.toObject(parameters.predicate);
    return operationProvider.createPartitionWideEntryWithPredicateOperationFactory(parameters.name, entryProcessor, predicate);
}
Also used : EntryProcessor(com.hazelcast.map.EntryProcessor) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider) Predicate(com.hazelcast.query.Predicate)

Example 4 with MapOperationProvider

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

the class MapExecuteOnAllKeysMessageTask method createOperationFactory.

@Override
protected OperationFactory createOperationFactory() {
    MapOperationProvider operationProvider = getOperationProvider(parameters.name);
    EntryProcessor entryProcessor = serializationService.toObject(parameters.entryProcessor);
    return operationProvider.createPartitionWideEntryOperationFactory(parameters.name, entryProcessor);
}
Also used : EntryProcessor(com.hazelcast.map.EntryProcessor) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider)

Example 5 with MapOperationProvider

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

the class MapExecuteOnKeysMessageTask method createOperationFactory.

@Override
protected OperationFactory createOperationFactory() {
    EntryProcessor processor = serializationService.toObject(parameters.entryProcessor);
    MapOperationProvider operationProvider = getMapOperationProvider(parameters.name);
    return operationProvider.createMultipleEntryOperationFactory(parameters.name, new HashSet<Data>(parameters.keys), processor);
}
Also used : EntryProcessor(com.hazelcast.map.EntryProcessor) Data(com.hazelcast.internal.serialization.Data) MapOperationProvider(com.hazelcast.map.impl.operation.MapOperationProvider)

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