use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class TransactionalMapProxySupport method containsKeyInternal.
public boolean containsKeyInternal(Data key) {
MapOperation operation = operationProvider.createContainsKeyOperation(name, key);
operation.setThreadId(ThreadUtil.getThreadId());
int partitionId = partitionService.getPartitionId(key);
try {
Future future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
return (Boolean) future.get();
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method putTransientInternal.
protected void putTransientInternal(Data key, Data value, long ttl, TimeUnit timeunit) {
MapOperation operation = operationProvider.createPutTransientOperation(name, key, value, getTimeInMillis(ttl, timeunit));
invokeOperation(key, operation);
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapProxySupport method getInternal.
protected Object getInternal(Data key) {
// todo action for read-backup true is not well tested.
if (getMapConfig().isReadBackupData()) {
Object fromBackup = readBackupDataOrNull(key);
if (fromBackup != null) {
return fromBackup;
}
}
MapOperation operation = operationProvider.createGetOperation(name, key);
operation.setThreadId(ThreadUtil.getThreadId());
return invokeOperation(key, operation);
}
use of com.hazelcast.map.impl.operation.MapOperation in project hazelcast by hazelcast.
the class MapKeyLoader method sendBatch.
private List<Future> sendBatch(Map<Integer, List<Data>> batch, boolean replaceExistingValues) {
Set<Entry<Integer, List<Data>>> entries = batch.entrySet();
List<Future> futures = new ArrayList<Future>(entries.size());
for (Entry<Integer, List<Data>> e : entries) {
int partitionId = e.getKey();
List<Data> keys = e.getValue();
MapOperation op = operationProvider.createLoadAllOperation(mapName, keys, replaceExistingValues);
InternalCompletableFuture<Object> future = opService.invokeOnPartition(SERVICE_NAME, op, partitionId);
futures.add(future);
}
return futures;
}
use of com.hazelcast.map.impl.operation.MapOperation 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);
}
}
Aggregations