Search in sources :

Example 6 with PartitionAccumulatorRegistry

use of com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry 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)

Example 7 with PartitionAccumulatorRegistry

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

the class QueryCacheEventPublisher method hintMapEvent.

// TODO known issue: Locked keys will also be cleared from the query-cache after calling a map-wide event like clear/evictAll
public void hintMapEvent(Address caller, String mapName, EntryEventType eventType, int numberOfEntriesAffected, int partitionId) {
    // this collection contains all defined query-caches on this map.
    Collection<PartitionAccumulatorRegistry> partitionAccumulatorRegistries = getPartitionAccumulatorRegistries(mapName);
    for (PartitionAccumulatorRegistry accumulatorRegistry : partitionAccumulatorRegistries) {
        Accumulator accumulator = accumulatorRegistry.getOrCreate(partitionId);
        QueryCacheEventData singleEventData = newQueryCacheEventDataBuilder(false).withPartitionId(partitionId).withEventType(eventType.getType()).build();
        accumulator.accumulate(singleEventData);
    }
}
Also used : Accumulator(com.hazelcast.map.impl.querycache.accumulator.Accumulator) PartitionAccumulatorRegistry(com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry) DefaultQueryCacheEventData(com.hazelcast.map.impl.querycache.event.DefaultQueryCacheEventData) QueryCacheEventData(com.hazelcast.map.impl.querycache.event.QueryCacheEventData)

Aggregations

PartitionAccumulatorRegistry (com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry)7 MapPublisherRegistry (com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry)4 PublisherContext (com.hazelcast.map.impl.querycache.publisher.PublisherContext)4 PublisherRegistry (com.hazelcast.map.impl.querycache.publisher.PublisherRegistry)4 AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)3 Accumulator (com.hazelcast.map.impl.querycache.accumulator.Accumulator)2 DefaultQueryCacheEventData (com.hazelcast.map.impl.querycache.event.DefaultQueryCacheEventData)2 QueryCacheEventData (com.hazelcast.map.impl.querycache.event.QueryCacheEventData)2 Data (com.hazelcast.nio.serialization.Data)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1