Search in sources :

Example 6 with Invalidator

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

the class InvalidationMetadataDistortionTest method distortRandomPartitionSequence.

private void distortRandomPartitionSequence(String mapName, HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    InternalPartitionService partitionService = nodeEngineImpl.getPartitionService();
    int partitionCount = partitionService.getPartitionCount();
    metaDataGenerator.setCurrentSequence(mapName, getInt(partitionCount), getInt(MAX_VALUE));
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 7 with Invalidator

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

the class InvalidationMetadataDistortionTest method distortRandomPartitionUuid.

private void distortRandomPartitionUuid(HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    int partitionCount = nodeEngineImpl.getPartitionService().getPartitionCount();
    int partitionId = getInt(partitionCount);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    metaDataGenerator.setUuid(partitionId, UuidUtil.newSecureUUID());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 8 with Invalidator

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

the class MapOperation method invalidateNearCache.

// TODO improve here it is possible that client cannot manage to attach listener
protected final void invalidateNearCache(Data key) {
    if (!mapContainer.hasInvalidationListener() || key == null) {
        return;
    }
    Invalidator invalidator = getNearCacheInvalidator();
    invalidator.invalidateKey(key, name, getCallerUuid());
}
Also used : Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)

Example 9 with Invalidator

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

the class MapOperation method invalidateAllKeysInNearCaches.

/**
     * This method helps to add clearing near-cache event only from one-partition
     * which matches partition-id of the map-name.
     */
protected final void invalidateAllKeysInNearCaches() {
    if (!mapContainer.hasInvalidationListener() || getPartitionId() != getNodeEngine().getPartitionService().getPartitionId(name)) {
        return;
    }
    Invalidator invalidator = getNearCacheInvalidator();
    invalidator.invalidateAllKeys(name, getCallerUuid());
}
Also used : Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)

Example 10 with Invalidator

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

the class MemberMapMetaDataFetcherTest method distortRandomPartitionUuid.

private void distortRandomPartitionUuid(int partition, UUID uuid, HazelcastInstance member) {
    NodeEngineImpl nodeEngineImpl = getNodeEngineImpl(member);
    MapService mapService = nodeEngineImpl.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager mapNearCacheManager = mapServiceContext.getMapNearCacheManager();
    Invalidator invalidator = mapNearCacheManager.getInvalidator();
    MetaDataGenerator metaDataGenerator = invalidator.getMetaDataGenerator();
    metaDataGenerator.setUuid(partition, uuid);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) Invalidator(com.hazelcast.internal.nearcache.impl.invalidation.Invalidator) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Aggregations

Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)14 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)12 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)12 MapService (com.hazelcast.map.impl.MapService)11 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)10 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)10 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)2 HashMap (java.util.HashMap)2 UUID (java.util.UUID)1