Search in sources :

Example 1 with SubscriberRegistry

use of com.hazelcast.map.impl.querycache.subscriber.SubscriberRegistry in project hazelcast by hazelcast.

the class ClientQueryCacheContext method recreateAllCaches.

public void recreateAllCaches() {
    // Since query cache is lost we are firing event lost event for each cache and for each partition
    QueryCacheFactory queryCacheFactory = subscriberContext.getQueryCacheFactory();
    Map<String, SubscriberRegistry> registryMap = subscriberContext.getMapSubscriberRegistry().getAll();
    for (SubscriberRegistry subscriberRegistry : registryMap.values()) {
        Map<String, Accumulator> accumulatorMap = subscriberRegistry.getAll();
        for (Accumulator accumulator : accumulatorMap.values()) {
            AccumulatorInfo info = accumulator.getInfo();
            String cacheId = info.getCacheId();
            InternalQueryCache queryCache = queryCacheFactory.getOrNull(cacheId);
            if (queryCache != null) {
                queryCache.recreate();
            }
        }
    }
}
Also used : QueryCacheFactory(com.hazelcast.map.impl.querycache.subscriber.QueryCacheFactory) Accumulator(com.hazelcast.map.impl.querycache.accumulator.Accumulator) SubscriberRegistry(com.hazelcast.map.impl.querycache.subscriber.SubscriberRegistry) InternalQueryCache(com.hazelcast.map.impl.querycache.subscriber.InternalQueryCache) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)

Aggregations

Accumulator (com.hazelcast.map.impl.querycache.accumulator.Accumulator)1 AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)1 InternalQueryCache (com.hazelcast.map.impl.querycache.subscriber.InternalQueryCache)1 QueryCacheFactory (com.hazelcast.map.impl.querycache.subscriber.QueryCacheFactory)1 SubscriberRegistry (com.hazelcast.map.impl.querycache.subscriber.SubscriberRegistry)1