use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method syncFill.
private void syncFill() {
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
BitSet nonLoadedStores = new BitSet(partitionCount);
int[] retryCount = new int[partitionCount];
for (int i = 0; i < partitionCount; i++) {
nonLoadedStores.set(i);
}
while (true) {
int remainingParallelRequests = PARALLEL_INIT_REQUESTS_LIMIT;
for (int nonLoadedPartition = nonLoadedStores.nextSetBit(0); nonLoadedPartition >= 0 && remainingParallelRequests > 0; nonLoadedPartition = nonLoadedStores.nextSetBit(nonLoadedPartition + 1)) {
ReplicatedRecordStore store = service.getReplicatedRecordStore(name, false, nonLoadedPartition);
if (store == null || !store.isLoaded()) {
if ((retryCount[nonLoadedPartition]++) % RETRY_INTERVAL_COUNT == 0) {
requestDataForPartition(nonLoadedPartition);
remainingParallelRequests--;
}
} else {
nonLoadedStores.clear(nonLoadedPartition);
}
}
if (nonLoadedStores.isEmpty()) {
break;
}
sleep();
}
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method entrySet.
@Nonnull
@Override
@SuppressWarnings("unchecked")
public Set<Entry<K, V>> entrySet() {
ensureNoSplitBrain(READ);
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
List<Entry> entries = new ArrayList<>();
for (ReplicatedRecordStore store : stores) {
entries.addAll(store.entrySet(true));
}
return (Set) new ResultSet(entries, IterationType.ENTRY);
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method keySet.
@Nonnull
@Override
public Set<K> keySet() {
ensureNoSplitBrain(READ);
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
Set<K> keySet = createHashSet(Math.max(KEY_SET_MIN_SIZE, stores.size() * KEY_SET_STORE_MULTIPLE));
for (ReplicatedRecordStore store : stores) {
keySet.addAll(store.keySet(true));
}
return keySet;
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method values.
@Nonnull
@Override
public Collection<V> values() {
ensureNoSplitBrain(READ);
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
Collection<V> values = new ArrayList<>();
for (ReplicatedRecordStore store : stores) {
values.addAll(store.values(true));
}
return values;
}
use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.
the class ReplicatedMapProxy method size.
@Override
public int size() {
ensureNoSplitBrain(READ);
Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(getName());
int size = 0;
for (ReplicatedRecordStore store : stores) {
size += store.size();
}
return size;
}
Aggregations