use of com.hazelcast.map.impl.operation.MapOperation 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;
}
use of com.hazelcast.map.impl.operation.MapOperation 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;
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapPutTransientMessageTask method prepareOperation.
@Override
protected Operation prepareOperation() {
MapOperation op = newOperation(parameters.name, parameters.key, parameters.value, parameters.ttl);
op.setThreadId(parameters.threadId);
return op;
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class HazelcastTestSupport method readFromMapBackup.
protected Object readFromMapBackup(HazelcastInstance instance, String mapName, Object key, int replicaIndex) {
try {
NodeEngine nodeEngine = Accessors.getNode(instance).getNodeEngine();
SerializationService ss = Accessors.getNode(instance).getSerializationService();
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
MapOperation get = getMapOperationProvider(instance, mapName).createGetOperation(mapName, ss.toData(key));
get.setPartitionId(partitionId);
get.setReplicaIndex(replicaIndex);
return Accessors.getNode(instance).getNodeEngine().getOperationService().invokeOnPartition(get).get();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
use of com.hazelcast.map.impl.operation.MapOperation 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();
}
Aggregations