Search in sources :

Example 6 with MapPublisherRegistry

use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.

the class DefaultRecordStore method hasQueryCache.

/**
     * @return {@code true} if this IMap has any query-cache, otherwise return {@code false}
     */
private boolean hasQueryCache() {
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    PublisherContext publisherContext = queryCacheContext.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(name);
    return publisherRegistry != null;
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

Example 7 with MapPublisherRegistry

use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.

the class QueryCacheUtil method getAccumulatorRegistryOrNull.

/**
     * Returns {@code PartitionAccumulatorRegistry} of a {@code QueryCache}.
     *
     * @see PartitionAccumulatorRegistry
     */
public static PartitionAccumulatorRegistry getAccumulatorRegistryOrNull(QueryCacheContext context, String mapName, String cacheName) {
    PublisherContext publisherContext = context.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(mapName);
    if (publisherRegistry == null) {
        return null;
    }
    return publisherRegistry.getOrNull(cacheName);
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

Example 8 with MapPublisherRegistry

use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.

the class PostJoinMapOperation method createQueryCaches.

private void createQueryCaches() {
    MapService mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    PublisherContext publisherContext = queryCacheContext.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    for (AccumulatorInfo info : infoList) {
        addAccumulatorInfo(queryCacheContext, info);
        PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrCreate(info.getMapName());
        publisherRegistry.getOrCreate(info.getCacheName());
        // marker listener.
        mapServiceContext.addLocalListenerAdapter(new ListenerAdapter<IMapEvent>() {

            @Override
            public void onEvent(IMapEvent event) {
            }
        }, info.getMapName());
    }
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) IMapEvent(com.hazelcast.core.IMapEvent) MapService(com.hazelcast.map.impl.MapService) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 9 with MapPublisherRegistry

use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.

the class AccumulatorConsumerOperation method removeAccumulator.

private void removeAccumulator(QueryCacheContext context, Accumulator accumulator) {
    PublisherContext publisherContext = context.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    AccumulatorInfo info = accumulator.getInfo();
    String mapName = info.getMapName();
    String cacheName = info.getCacheName();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(mapName);
    if (publisherRegistry == null) {
        return;
    }
    PartitionAccumulatorRegistry partitionAccumulatorRegistry = publisherRegistry.getOrNull(cacheName);
    if (partitionAccumulatorRegistry == null) {
        return;
    }
    partitionAccumulatorRegistry.remove(getPartitionId());
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PartitionAccumulatorRegistry(com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

Aggregations

MapPublisherRegistry (com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry)9 PublisherContext (com.hazelcast.map.impl.querycache.publisher.PublisherContext)9 PublisherRegistry (com.hazelcast.map.impl.querycache.publisher.PublisherRegistry)9 PartitionAccumulatorRegistry (com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry)4 AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)3 QueryCacheContext (com.hazelcast.map.impl.querycache.QueryCacheContext)2 IMapEvent (com.hazelcast.core.IMapEvent)1 MapService (com.hazelcast.map.impl.MapService)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1