use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class RemoveOperation method run.
@Override
public void run() throws Exception {
service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
Object removed = store.remove(key);
oldValue = getNodeEngine().toData(removed);
response = new VersionResponsePair(removed, store.getVersion());
Address thisAddress = getNodeEngine().getThisAddress();
if (!getCallerAddress().equals(thisAddress)) {
sendUpdateCallerOperation(true);
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicateUpdateToCallerOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, true, getPartitionId());
long currentVersion = store.getVersion();
long updateVersion = response.getVersion();
if (currentVersion >= updateVersion) {
if (logger.isFineEnabled()) {
logger.fine("Rejecting stale update received for replicated map '" + name + "' (partitionId " + getPartitionId() + ") (current version " + currentVersion + ") (update version " + updateVersion + ")");
}
return;
}
Object key = store.marshall(dataKey);
Object value = store.marshall(dataValue);
if (isRemove) {
store.removeWithVersion(key, updateVersion);
} else {
store.putWithVersion(key, value, ttl, TimeUnit.MILLISECONDS, true, updateVersion);
}
publishEvent();
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ContainsKeyOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, false, getPartitionId());
response = store != null && store.containsKey(key);
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class EntrySetOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
List<Map.Entry<Object, ReplicatedRecord>> entries = new ArrayList<>();
for (ReplicatedRecordStore store : stores) {
entries.addAll(store.entrySet(false));
}
ArrayList<Map.Entry<Data, Data>> dataEntries = new ArrayList<>(entries.size());
SerializationService serializationService = getNodeEngine().getSerializationService();
for (Map.Entry<Object, ReplicatedRecord> entry : entries) {
Data key = serializationService.toData(entry.getKey());
Data value = serializationService.toData(entry.getValue().getValue());
dataEntries.add(new AbstractMap.SimpleImmutableEntry<>(key, value));
}
response = new MapEntries(dataEntries);
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class GetOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, false, getPartitionId());
if (store != null) {
ReplicatedRecord record = store.getReplicatedRecord(key);
if (record != null) {
response = record.getValue();
}
}
}
Aggregations