use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class SetReadCursorOperation method setReadCursor.
private boolean setReadCursor() {
QueryCacheContext context = getContext();
Accumulator accumulator = getAccumulatorOrNull(context, name, cacheName, getPartitionId());
if (accumulator == null) {
return false;
}
return accumulator.setHead(sequence);
}
use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class AccumulatorSweeper method flushAccumulator.
public static void flushAccumulator(PublisherContext publisherContext, int partitionId) {
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();
Accumulator accumulator = accumulatorMap.get(partitionId);
if (accumulator == null) {
continue;
}
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 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.QueryCacheContext in project hazelcast by hazelcast.
the class ClientMapProxy method getQueryCacheInternal.
private QueryCache getQueryCacheInternal(String name, MapListener listener, Predicate predicate, Boolean includeValue, IMap map) {
QueryCacheContext context = getQueryContext();
QueryCacheRequest request = newQueryCacheRequest().withUserGivenCacheName(name).withCacheName(UuidUtil.newUnsecureUuidString()).withListener(listener).withPredicate(predicate).withIncludeValue(includeValue).forMap(map).withContext(context);
return createQueryCache(request);
}
use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.
the class ClientQueryCacheRecoveryUponEventLossTest method setTestSequencer.
private void setTestSequencer(IMap map, int eventCount) {
ClientMapProxy proxy = (ClientMapProxy) map;
QueryCacheContext queryCacheContext = proxy.getQueryContext();
queryCacheContext.setSubscriberContext(new TestClientSubscriberContext(queryCacheContext, eventCount, true));
}
Aggregations