Search in sources :

Example 31 with MetaDataGenerator

use of com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator in project hazelcast by hazelcast.

the class CacheGetInvalidationMetaDataOperation method getNamePartitionSequenceList.

private Map<String, List<Map.Entry<Integer, Long>>> getNamePartitionSequenceList(List<Integer> ownedPartitionIds) {
    MetaDataGenerator metaDataGenerator = getPartitionMetaDataGenerator();
    Map<String, List<Map.Entry<Integer, Long>>> sequences = new HashMap<String, List<Map.Entry<Integer, Long>>>(ownedPartitionIds.size());
    for (String name : names) {
        List<Map.Entry<Integer, Long>> mapSequences = new ArrayList<Map.Entry<Integer, Long>>();
        for (Integer partitionId : ownedPartitionIds) {
            long partitionSequence = metaDataGenerator.currentSequence(name, partitionId);
            if (partitionSequence != 0) {
                mapSequences.add(new AbstractMap.SimpleEntry<Integer, Long>(partitionId, partitionSequence));
            }
        }
        sequences.put(name, mapSequences);
    }
    return sequences;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AbstractMap(java.util.AbstractMap) ArrayList(java.util.ArrayList) List(java.util.List) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) HashMap(java.util.HashMap) AbstractMap(java.util.AbstractMap) Map(java.util.Map)

Example 32 with MetaDataGenerator

use of com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator in project hazelcast by hazelcast.

the class CacheGetInvalidationMetaDataOperation method getPartitionUuidList.

private Map<Integer, UUID> getPartitionUuidList(List<Integer> ownedPartitionIds) {
    MetaDataGenerator metaDataGenerator = getPartitionMetaDataGenerator();
    Map<Integer, UUID> partitionUuids = new HashMap<Integer, UUID>(ownedPartitionIds.size());
    for (Integer partitionId : ownedPartitionIds) {
        UUID uuid = metaDataGenerator.getOrCreateUuid(partitionId);
        partitionUuids.put(partitionId, uuid);
    }
    return partitionUuids;
}
Also used : HashMap(java.util.HashMap) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) UUID(java.util.UUID)

Example 33 with MetaDataGenerator

use of com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator in project hazelcast by hazelcast.

the class MapGetInvalidationMetaDataOperation method getPartitionUuidList.

private Map<Integer, UUID> getPartitionUuidList(List<Integer> ownedPartitionIds) {
    MetaDataGenerator metaDataGenerator = getPartitionMetaDataGenerator();
    Map<Integer, UUID> partitionUuids = createHashMap(ownedPartitionIds.size());
    for (Integer partitionId : ownedPartitionIds) {
        UUID uuid = metaDataGenerator.getOrCreateUuid(partitionId);
        partitionUuids.put(partitionId, uuid);
    }
    return partitionUuids;
}
Also used : MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) UUID(java.util.UUID)

Example 34 with MetaDataGenerator

use of com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator in project hazelcast by hazelcast.

the class MapGetInvalidationMetaDataOperation method getNamePartitionSequenceList.

private Map<String, List<Map.Entry<Integer, Long>>> getNamePartitionSequenceList(List<Integer> ownedPartitionIds) {
    MetaDataGenerator metaDataGenerator = getPartitionMetaDataGenerator();
    Map<String, List<Map.Entry<Integer, Long>>> sequences = new HashMap<>(ownedPartitionIds.size());
    for (String name : mapNames) {
        List<Map.Entry<Integer, Long>> mapSequences = new ArrayList<>();
        for (Integer partitionId : ownedPartitionIds) {
            long partitionSequence = metaDataGenerator.currentSequence(name, partitionId);
            if (partitionSequence != 0) {
                mapSequences.add(new AbstractMap.SimpleEntry<>(partitionId, partitionSequence));
            }
        }
        sequences.put(name, mapSequences);
    }
    return sequences;
}
Also used : HashMap(java.util.HashMap) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap) ArrayList(java.util.ArrayList) AbstractMap(java.util.AbstractMap) ArrayList(java.util.ArrayList) List(java.util.List) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) HashMap(java.util.HashMap) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap) Map(java.util.Map) AbstractMap(java.util.AbstractMap)

Example 35 with MetaDataGenerator

use of com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator in project hazelcast by hazelcast.

the class MapChunk method applyNearCacheState.

private void applyNearCacheState(RecordStore recordStore) {
    MetaDataGenerator metaDataGenerator = getPartitionMetaDataGenerator(recordStore);
    int partitionId = getPartitionId();
    if (partitionUuid != null) {
        metaDataGenerator.setUuid(partitionId, partitionUuid);
    }
    metaDataGenerator.setCurrentSequence(recordStore.getName(), partitionId, currentSequence);
}
Also used : MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)

Aggregations

MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)47 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)31 MapService (com.hazelcast.map.impl.MapService)23 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)20 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)20 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)20 Accessors.getNodeEngineImpl (com.hazelcast.test.Accessors.getNodeEngineImpl)17 CacheEventHandler (com.hazelcast.cache.impl.CacheEventHandler)10 CacheService (com.hazelcast.cache.impl.CacheService)10 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)8 ArrayList (java.util.ArrayList)8 UUID (java.util.UUID)8 HashMap (java.util.HashMap)5 Config (com.hazelcast.config.Config)4 NearCacheConfig (com.hazelcast.config.NearCacheConfig)4 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 AssertTask (com.hazelcast.test.AssertTask)4 Test (org.junit.Test)4 ICacheService (com.hazelcast.cache.impl.ICacheService)3 Map (java.util.Map)3