Search in sources :

Example 6 with ReplicatedRecordStore

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();
    }
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) BitSet(java.util.BitSet)

Example 7 with ReplicatedRecordStore

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);
}
Also used : ResultSet(com.hazelcast.internal.util.ResultSet) Set(java.util.Set) SetUtil.createHashSet(com.hazelcast.internal.util.SetUtil.createHashSet) BitSet(java.util.BitSet) ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ArrayList(java.util.ArrayList) ResultSet(com.hazelcast.internal.util.ResultSet) Nonnull(javax.annotation.Nonnull)

Example 8 with ReplicatedRecordStore

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;
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) Nonnull(javax.annotation.Nonnull)

Example 9 with ReplicatedRecordStore

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;
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ArrayList(java.util.ArrayList) Nonnull(javax.annotation.Nonnull)

Example 10 with ReplicatedRecordStore

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;
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)

Aggregations

ReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)38 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)19 ReplicatedRecord (com.hazelcast.replicatedmap.impl.record.ReplicatedRecord)7 ArrayList (java.util.ArrayList)7 Data (com.hazelcast.internal.serialization.Data)5 ILogger (com.hazelcast.logging.ILogger)4 Nonnull (javax.annotation.Nonnull)4 Address (com.hazelcast.cluster.Address)3 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 ReplicatedMapProxy (com.hazelcast.replicatedmap.impl.ReplicatedMapProxy)3 Map (java.util.Map)3 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)2 LocalReplicatedMapStatsImpl (com.hazelcast.internal.monitor.impl.LocalReplicatedMapStatsImpl)2 DataCollection (com.hazelcast.map.impl.DataCollection)2 PartitionContainer (com.hazelcast.replicatedmap.impl.PartitionContainer)2 AbstractBaseReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.AbstractBaseReplicatedRecordStore)2 AbstractReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore)2 RecordMigrationInfo (com.hazelcast.replicatedmap.impl.record.RecordMigrationInfo)2 BitSet (java.util.BitSet)2 Member (com.hazelcast.cluster.Member)1