use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method containsKey.
@Override
public boolean containsKey(@Nonnull Object key) {
ensureNoSplitBrain(READ);
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
int partitionId = partitionService.getPartitionId(key);
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, false, partitionId);
return store != null && store.containsKey(key);
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method get.
@Override
public V get(@Nonnull Object key) {
ensureNoSplitBrain(READ);
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
int partitionId = partitionService.getPartitionId(key);
ReplicatedRecordStore store = service.getReplicatedRecordStore(getName(), false, partitionId);
if (store == null) {
return null;
}
return (V) store.get(key);
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method isEmpty.
@Override
public boolean isEmpty() {
ensureNoSplitBrain(READ);
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
for (ReplicatedRecordStore store : stores) {
if (!store.isEmpty()) {
return false;
}
}
return true;
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class CheckReplicaVersionOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
int partitionId = getPartitionId();
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(getPartitionId());
ConcurrentMap<String, ReplicatedRecordStore> stores = container.getStores();
for (Map.Entry<String, Long> entry : versions.entrySet()) {
String name = entry.getKey();
Long version = entry.getValue();
ReplicatedRecordStore store = stores.get(name);
if (store == null) {
if (logger.isFineEnabled()) {
logger.fine("Missing store on the replica of replicated map '" + name + "' (partitionId " + partitionId + ") (owner version " + version + ")");
}
requestDataFromOwner(name);
} else if (store.isStale(version)) {
if (logger.isFineEnabled()) {
logger.fine("Stale replica on replicated map '" + name + "' (partitionId " + partitionId + ") (owner version " + version + ") (replica version " + store.getVersion() + ")");
}
requestDataFromOwner(name);
}
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class KeySetOperation method run.
@Override
public void run() throws Exception {
ReplicatedMapService service = getService();
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
List<Object> keys = new ArrayList<>();
for (ReplicatedRecordStore store : stores) {
keys.addAll(store.keySet(false));
}
ArrayList<Data> dataKeys = new ArrayList<>(keys.size());
SerializationService serializationService = getNodeEngine().getSerializationService();
for (Object key : keys) {
dataKeys.add(serializationService.toData(key));
}
response = new DataCollection(dataKeys);
}
Aggregations