use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.
the class MapPostJoinAwareService method getAccumulatorInfoList.
private List<AccumulatorInfo> getAccumulatorInfoList() {
List<AccumulatorInfo> infoList = new ArrayList<AccumulatorInfo>();
PublisherContext publisherContext = mapServiceContext.getQueryCacheContext().getPublisherContext();
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
Map<String, PublisherRegistry> cachesOfMaps = mapPublisherRegistry.getAll();
Collection<PublisherRegistry> publisherRegistries = cachesOfMaps.values();
for (PublisherRegistry publisherRegistry : publisherRegistries) {
Collection<PartitionAccumulatorRegistry> partitionAccumulatorRegistries = publisherRegistry.getAll().values();
for (PartitionAccumulatorRegistry accumulatorRegistry : partitionAccumulatorRegistries) {
AccumulatorInfo info = accumulatorRegistry.getInfo();
infoList.add(info);
}
}
return infoList;
}
use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.
the class QueryCacheEventPublisher method getPartitionAccumulatorRegistries.
private Collection<PartitionAccumulatorRegistry> getPartitionAccumulatorRegistries(String mapName) {
PublisherContext publisherContext = queryCacheContext.getPublisherContext();
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(mapName);
if (publisherRegistry == null) {
return Collections.emptySet();
}
// this collection contains all query-caches for this map
return publisherRegistry.getAll().values();
}
use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.
the class DestroyQueryCacheOperation method removePublisherAccumulators.
private void removePublisherAccumulators() {
PublisherContext publisherContext = getPublisherContext();
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(name);
if (publisherRegistry == null) {
return;
}
publisherRegistry.remove(cacheName);
}
use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.
the class PublisherCreateOperation method registerPublisherAccumulator.
private void registerPublisherAccumulator() {
String mapName = info.getMapName();
String cacheName = info.getCacheName();
PublisherContext publisherContext = getPublisherContext();
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrCreate(mapName);
PartitionAccumulatorRegistry partitionAccumulatorRegistry = publisherRegistry.getOrCreate(cacheName);
partitionAccumulatorRegistry.setUuid(getCallerUuid());
}
use of com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry in project hazelcast by hazelcast.
the class AccumulatorScannerTask method scanAccumulators.
void scanAccumulators() {
PublisherContext publisherContext = context.getPublisherContext();
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
Map<String, PublisherRegistry> publisherRegistryMap = mapPublisherRegistry.getAll();
Set<Map.Entry<String, PublisherRegistry>> publishers = publisherRegistryMap.entrySet();
for (Map.Entry<String, PublisherRegistry> entry : publishers) {
PublisherRegistry publisherRegistry = entry.getValue();
Map<String, PartitionAccumulatorRegistry> accumulatorRegistryMap = publisherRegistry.getAll();
Set<Map.Entry<String, PartitionAccumulatorRegistry>> accumulators = accumulatorRegistryMap.entrySet();
for (Map.Entry<String, PartitionAccumulatorRegistry> accumulatorRegistryEntry : accumulators) {
PartitionAccumulatorRegistry accumulatorRegistry = accumulatorRegistryEntry.getValue();
Map<Integer, Accumulator> accumulatorMap = accumulatorRegistry.getAll();
for (Map.Entry<Integer, Accumulator> accumulatorEntry : accumulatorMap.entrySet()) {
Integer partitionId = accumulatorEntry.getKey();
Accumulator accumulator = accumulatorEntry.getValue();
int size = accumulator.size();
if (size > 0) {
consumer.consume(accumulator, partitionId);
}
}
}
}
sendConsumerOperation();
consumer.reset();
}
Aggregations