Search in sources :

Example 11 with PublisherRegistry

use of com.hazelcast.map.impl.querycache.publisher.PublisherRegistry 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.getCacheId());
        // marker listener.
        mapServiceContext.addLocalListenerAdapter((ListenerAdapter<IMapEvent>) event -> {
        }, info.getMapName());
    }
}
Also used : MapDataSerializerHook(com.hazelcast.map.impl.MapDataSerializerHook) Address(com.hazelcast.cluster.Address) IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) IMapEvent(com.hazelcast.map.IMapEvent) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap) ArrayList(java.util.ArrayList) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) Operation(com.hazelcast.spi.impl.operationservice.Operation) Map(java.util.Map) ObjectDataInput(com.hazelcast.nio.ObjectDataInput) LinkedList(java.util.LinkedList) MapContainer(com.hazelcast.map.impl.MapContainer) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext) MapInterceptor(com.hazelcast.map.MapInterceptor) TargetAware(com.hazelcast.spi.impl.operationservice.TargetAware) IOException(java.io.IOException) MapService(com.hazelcast.map.impl.MapService) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) AbstractMap(java.util.AbstractMap) List(java.util.List) AccumulatorInfoSupplier(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfoSupplier) ObjectDataOutput(com.hazelcast.nio.ObjectDataOutput) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) ListenerAdapter(com.hazelcast.map.impl.ListenerAdapter) Collections(java.util.Collections) InterceptorRegistry(com.hazelcast.map.impl.InterceptorRegistry) 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.map.IMapEvent) MapService(com.hazelcast.map.impl.MapService) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 12 with PublisherRegistry

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

the class QueryCacheUtil method getAccumulatorRegistryOrNull.

/**
 * Returns {@code PartitionAccumulatorRegistry} of a {@code QueryCache}.
 *
 * @see PartitionAccumulatorRegistry
 */
@Nullable
public static PartitionAccumulatorRegistry getAccumulatorRegistryOrNull(QueryCacheContext context, String mapName, String cacheId) {
    PublisherContext publisherContext = context.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(mapName);
    if (publisherRegistry == null) {
        return null;
    }
    return publisherRegistry.getOrNull(cacheId);
}
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) Nullable(javax.annotation.Nullable)

Aggregations

MapPublisherRegistry (com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry)12 PublisherContext (com.hazelcast.map.impl.querycache.publisher.PublisherContext)12 PublisherRegistry (com.hazelcast.map.impl.querycache.publisher.PublisherRegistry)12 PartitionAccumulatorRegistry (com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry)7 AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)3 QueryCacheContext (com.hazelcast.map.impl.querycache.QueryCacheContext)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 Address (com.hazelcast.cluster.Address)1 MapUtil.createHashMap (com.hazelcast.internal.util.MapUtil.createHashMap)1 IMapEvent (com.hazelcast.map.IMapEvent)1 MapInterceptor (com.hazelcast.map.MapInterceptor)1 InterceptorRegistry (com.hazelcast.map.impl.InterceptorRegistry)1 ListenerAdapter (com.hazelcast.map.impl.ListenerAdapter)1 MapContainer (com.hazelcast.map.impl.MapContainer)1 MapDataSerializerHook (com.hazelcast.map.impl.MapDataSerializerHook)1 MapService (com.hazelcast.map.impl.MapService)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 AccumulatorInfoSupplier (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfoSupplier)1 ObjectDataInput (com.hazelcast.nio.ObjectDataInput)1