use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MapProxyImpl method containsValue.
@Override
public boolean containsValue(Object v) {
checkNotNull(v, NULL_VALUE_IS_NOT_ALLOWED);
Data value = toData(v);
return containsValueInternal(value);
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MapProxyImpl method put.
@Override
public V put(K k, V v, long ttl, TimeUnit timeunit) {
checkNotNull(k, NULL_KEY_IS_NOT_ALLOWED);
checkNotNull(v, NULL_VALUE_IS_NOT_ALLOWED);
Data key = toData(k, partitionStrategy);
Data value = toData(v);
Data result = putInternal(key, value, ttl, timeunit);
return toObject(result);
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MapProxySupport method removeAsyncInternal.
protected InternalCompletableFuture<Data> removeAsyncInternal(Data key) {
int partitionId = getNodeEngine().getPartitionService().getPartitionId(key);
MapOperation operation = operationProvider.createRemoveOperation(name, key, false);
operation.setThreadId(ThreadUtil.getThreadId());
try {
long startTime = System.currentTimeMillis();
InternalCompletableFuture<Data> future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
if (statisticsEnabled) {
future.andThen(new IncrementStatsExecutionCallback<Data>(operation, startTime));
}
return future;
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MapProxySupport method loadInternal.
/**
* Maps keys to corresponding partitions and sends operations to them.
*/
protected void loadInternal(Iterable<Data> dataKeys, boolean replaceExistingValues) {
Map<Integer, List<Data>> partitionIdToKeys = getPartitionIdToKeysMap(dataKeys);
Iterable<Entry<Integer, List<Data>>> entries = partitionIdToKeys.entrySet();
for (Entry<Integer, List<Data>> entry : entries) {
Integer partitionId = entry.getKey();
List<Data> correspondingKeys = entry.getValue();
Operation operation = createLoadAllOperation(correspondingKeys, replaceExistingValues);
operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
}
waitUntilLoaded();
}
use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.
the class MapProxySupport method executeOnKeyInternal.
public Data executeOnKeyInternal(Data key, EntryProcessor entryProcessor) {
int partitionId = partitionService.getPartitionId(key);
MapOperation operation = operationProvider.createEntryOperation(name, key, entryProcessor);
operation.setThreadId(ThreadUtil.getThreadId());
try {
Future future = operationService.createInvocationBuilder(SERVICE_NAME, operation, partitionId).setResultDeserialized(false).invoke();
return (Data) future.get();
} catch (Throwable t) {
throw rethrow(t);
}
}
Aggregations