use of com.hazelcast.map.impl.querycache.publisher.PublisherContext 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();
}
use of com.hazelcast.map.impl.querycache.publisher.PublisherContext 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;
}
use of com.hazelcast.map.impl.querycache.publisher.PublisherContext in project hazelcast by hazelcast.
the class AccumulatorScannerTask method createConsumerOperation.
private Operation createConsumerOperation(int partitionId, Queue<Accumulator> accumulators) {
PublisherContext publisherContext = context.getPublisherContext();
NodeEngineImpl nodeEngine = (NodeEngineImpl) publisherContext.getNodeEngine();
Operation operation = new AccumulatorConsumerOperation(accumulators, MAX_PROCESSABLE_ACCUMULATOR_COUNT);
operation.setNodeEngine(nodeEngine).setCallerUuid(nodeEngine.getLocalMember().getUuid()).setPartitionId(partitionId).setValidateTarget(false).setService(nodeEngine.getService(MapService.SERVICE_NAME));
return operation;
}
use of com.hazelcast.map.impl.querycache.publisher.PublisherContext 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);
}
use of com.hazelcast.map.impl.querycache.publisher.PublisherContext 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());
}
}
Aggregations