use of com.hazelcast.replicatedmap.impl.operation.PutOperation in project hazelcast by hazelcast.
the class ReplicatedMapReorderedReplicationTest method put.
private <K, V> V put(final NodeEngine nodeEngine, final String mapName, final int partitionId, K key, V value) {
isNotNull(key, "key must not be null!");
isNotNull(value, "value must not be null!");
Data dataKey = nodeEngine.toData(key);
Data dataValue = nodeEngine.toData(value);
PutOperation putOperation = new PutOperation(mapName, dataKey, dataValue);
InternalCompletableFuture<Object> future = nodeEngine.getOperationService().invokeOnPartition(ReplicatedMapService.SERVICE_NAME, putOperation, partitionId);
VersionResponsePair result = (VersionResponsePair) future.join();
return nodeEngine.toObject(result.getResponse());
}
use of com.hazelcast.replicatedmap.impl.operation.PutOperation in project hazelcast by hazelcast.
the class ReplicatedMapProxy method put.
@Override
public V put(K key, V value, long ttl, TimeUnit timeUnit) {
isNotNull(key, "key");
isNotNull(value, "value");
isNotNull(timeUnit, "timeUnit");
if (ttl < 0) {
throw new IllegalArgumentException("ttl must be a positive integer");
}
long ttlMillis = timeUnit.toMillis(ttl);
Data dataKey = nodeEngine.toData(key);
Data dataValue = nodeEngine.toData(value);
int partitionId = partitionService.getPartitionId(dataKey);
PutOperation putOperation = new PutOperation(getName(), dataKey, dataValue, ttlMillis);
InternalCompletableFuture<Object> future = getOperationService().invokeOnPartition(getServiceName(), putOperation, partitionId);
VersionResponsePair result = (VersionResponsePair) future.join();
return nodeEngine.toObject(result.getResponse());
}
use of com.hazelcast.replicatedmap.impl.operation.PutOperation in project hazelcast by hazelcast.
the class ReplicatedMapProxy method put.
@Override
public V put(K key, V value) {
isNotNull(key, "key");
isNotNull(value, "value");
Data dataKey = nodeEngine.toData(key);
Data dataValue = nodeEngine.toData(value);
int partitionId = nodeEngine.getPartitionService().getPartitionId(dataKey);
PutOperation putOperation = new PutOperation(getName(), dataKey, dataValue);
InternalCompletableFuture<Object> future = getOperationService().invokeOnPartition(getServiceName(), putOperation, partitionId);
VersionResponsePair result = (VersionResponsePair) future.join();
return nodeEngine.toObject(result.getResponse());
}
Aggregations