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);
}
}
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;
}
use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.
the class MapReplicationSupportingService method handleUpdate.
private void handleUpdate(MapReplicationUpdate replicationUpdate) {
EntryView entryView = replicationUpdate.getEntryView();
MapMergePolicy mergePolicy = replicationUpdate.getMergePolicy();
String mapName = replicationUpdate.getMapName();
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(mapName);
Data dataKey = mapServiceContext.toData(entryView.getKey(), mapContainer.getPartitioningStrategy());
MapOperation operation = operationProvider.createMergeOperation(mapName, dataKey, entryView, mergePolicy, true);
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(entryView.getKey());
Future f = nodeEngine.getOperationService().invokeOnPartition(SERVICE_NAME, operation, partitionId);
f.get();
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
use of com.hazelcast.map.impl.operation.MapOperationProvider in project hazelcast by hazelcast.
the class MapPartitionIterator method fetch.
protected List fetch() {
String name = mapProxy.getName();
String serviceName = mapProxy.getServiceName();
MapOperationProvider operationProvider = mapProxy.getOperationProvider();
OperationService operationService = mapProxy.getOperationService();
if (prefetchValues) {
MapOperation operation = operationProvider.createFetchEntriesOperation(name, lastTableIndex, fetchSize);
InternalCompletableFuture<MapEntriesWithCursor> future = operationService.invokeOnPartition(serviceName, operation, partitionId);
MapEntriesWithCursor mapEntriesWithCursor = future.join();
setLastTableIndex(mapEntriesWithCursor.getEntries(), mapEntriesWithCursor.getNextTableIndexToReadFrom());
return mapEntriesWithCursor.getEntries();
} else {
MapOperation operation = operationProvider.createFetchKeysOperation(name, lastTableIndex, fetchSize);
InternalCompletableFuture<MapKeysWithCursor> future = operationService.invokeOnPartition(serviceName, operation, partitionId);
MapKeysWithCursor mapKeysWithCursor = future.join();
setLastTableIndex(mapKeysWithCursor.getKeys(), mapKeysWithCursor.getNextTableIndexToReadFrom());
return mapKeysWithCursor.getKeys();
}
}
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;
}
Aggregations