use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class AccumulatorSweeper method flushAllAccumulators.
public static void flushAllAccumulators(PublisherContext publisherContext) {
QueryCacheContext context = publisherContext.getContext();
EventPublisherAccumulatorProcessor processor = new EventPublisherAccumulatorProcessor(context.getQueryCacheEventService());
PublisherAccumulatorHandler handler = new PublisherAccumulatorHandler(context, processor);
MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
Map<String, PublisherRegistry> allPublisherRegistryMap = mapPublisherRegistry.getAll();
for (PublisherRegistry publisherRegistry : allPublisherRegistryMap.values()) {
Map<String, PartitionAccumulatorRegistry> accumulatorRegistryMap = publisherRegistry.getAll();
for (PartitionAccumulatorRegistry accumulatorRegistry : accumulatorRegistryMap.values()) {
Map<Integer, Accumulator> accumulatorMap = accumulatorRegistry.getAll();
for (Map.Entry<Integer, Accumulator> entry : accumulatorMap.entrySet()) {
Integer partitionId = entry.getKey();
Accumulator accumulator = entry.getValue();
processor.setInfo(accumulator.getInfo());
// give 0 to delay-time in order to fetch all events in the accumulator
accumulator.poll(handler, 0, TimeUnit.SECONDS);
// send end event
QueryCacheEventData eventData = createEndOfSequenceEvent(partitionId);
processor.process(eventData);
}
}
}
}
use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class MapClientAwareService method clientDisconnected.
@Override
public void clientDisconnected(UUID clientUuid) {
QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
PublisherContext publisherContext = queryCacheContext.getPublisherContext();
publisherContext.handleDisconnectedSubscriber(clientUuid);
}
use of com.hazelcast.map.impl.querycache.QueryCacheContext 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());
}
}
use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class PublisherCreateOperation method getPartitionIdsOfAccumulators.
private Collection<Integer> getPartitionIdsOfAccumulators() {
String mapName = info.getMapName();
String cacheId = info.getCacheId();
QueryCacheContext context = getContext();
return QueryCacheUtil.getAccumulators(context, mapName, cacheId).keySet();
}
use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class ClientQueryCacheEventLostListenerTest method setTestSequencer.
private void setTestSequencer(IMap map, int eventCount) {
ClientMapProxy proxy = (ClientMapProxy) map;
QueryCacheContext queryCacheContext = proxy.getQueryCacheContext();
queryCacheContext.setSubscriberContext(new TestClientSubscriberContext(queryCacheContext, eventCount, true));
}
Aggregations