Search in sources :

Example 36 with ReplicatedRecordStore

use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.

the class IsEmptyOperation method run.

@Override
public void run() throws Exception {
    ReplicatedMapService service = getService();
    Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
    for (ReplicatedRecordStore store : stores) {
        if (!store.isEmpty()) {
            response = false;
            return;
        }
    }
    response = true;
}
Also used : ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService)

Example 37 with ReplicatedRecordStore

use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.

the class ReplicationOperation method fetchReplicatedMapRecords.

private void fetchReplicatedMapRecords(PartitionContainer container) {
    int storeCount = container.getStores().size();
    data = createHashMap(storeCount);
    versions = createHashMap(storeCount);
    for (Map.Entry<String, ReplicatedRecordStore> entry : container.getStores().entrySet()) {
        String name = entry.getKey();
        ReplicatedRecordStore store = entry.getValue();
        Set<RecordMigrationInfo> recordSet = createHashSet(store.size());
        Iterator<ReplicatedRecord> iterator = store.recordIterator();
        while (iterator.hasNext()) {
            ReplicatedRecord record = iterator.next();
            Data dataKey = serializationService.toData(record.getKeyInternal());
            Data dataValue = serializationService.toData(record.getValueInternal());
            RecordMigrationInfo migrationInfo = new RecordMigrationInfo();
            migrationInfo.setKey(dataKey);
            migrationInfo.setValue(dataValue);
            migrationInfo.setTtl(record.getTtlMillis());
            migrationInfo.setHits(record.getHits());
            migrationInfo.setCreationTime(record.getCreationTime());
            migrationInfo.setLastAccessTime(record.getLastAccessTime());
            migrationInfo.setLastUpdateTime(record.getUpdateTime());
            recordSet.add(migrationInfo);
        }
        data.put(name, recordSet);
        versions.put(name, store.getVersion());
    }
}
Also used : ReplicatedRecord(com.hazelcast.replicatedmap.impl.record.ReplicatedRecord) AbstractReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore) ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) Data(com.hazelcast.internal.serialization.Data) RecordMigrationInfo(com.hazelcast.replicatedmap.impl.record.RecordMigrationInfo) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap) Map(java.util.Map)

Example 38 with ReplicatedRecordStore

use of com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore in project hazelcast by hazelcast.

the class ValuesOperation method run.

@Override
public void run() throws Exception {
    ReplicatedMapService service = getService();
    Collection<ReplicatedRecordStore> stores = service.getAllReplicatedRecordStores(name);
    Collection<ReplicatedRecord> values = new ArrayList<>();
    for (ReplicatedRecordStore store : stores) {
        values.addAll(store.values(false));
    }
    Collection<Data> dataValues = new ArrayList<>(values.size());
    SerializationService serializationService = getNodeEngine().getSerializationService();
    for (ReplicatedRecord value : values) {
        dataValues.add(serializationService.toData(value.getValue()));
    }
    response = new DataCollection(dataValues);
}
Also used : ReplicatedRecord(com.hazelcast.replicatedmap.impl.record.ReplicatedRecord) DataCollection(com.hazelcast.map.impl.DataCollection) ReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) ArrayList(java.util.ArrayList) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data)

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