Search in sources :

Example 16 with QueryCacheContext

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}
 */
public boolean hasQueryCache() {
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    PublisherContext publisherContext = queryCacheContext.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(name);
    return publisherRegistry != null;
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

Example 17 with QueryCacheContext

use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.

the class QueryCacheRecoveryUponEventLossTest method getBrokenSequences.

private Map getBrokenSequences(HazelcastInstance instance, String mapName, QueryCache queryCache) {
    Node node = getNode(instance);
    MapService service = node.getNodeEngine().getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = service.getMapServiceContext();
    QueryCacheContext context = mapServiceContext.getQueryCacheContext();
    SubscriberContext subscriberContext = context.getSubscriberContext();
    MapSubscriberRegistry mapSubscriberRegistry = subscriberContext.getMapSubscriberRegistry();
    SubscriberRegistry subscriberRegistry = mapSubscriberRegistry.getOrNull(mapName);
    if (subscriberRegistry == null) {
        return Collections.emptyMap();
    }
    String cacheId = ((InternalQueryCache) queryCache).getCacheId();
    Accumulator accumulator = subscriberRegistry.getOrNull(cacheId);
    if (accumulator == null) {
        return Collections.emptyMap();
    }
    SubscriberAccumulator subscriberAccumulator = (SubscriberAccumulator) accumulator;
    return subscriberAccumulator.getBrokenSequences();
}
Also used : Accumulator(com.hazelcast.map.impl.querycache.accumulator.Accumulator) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Node(com.hazelcast.instance.impl.Node) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 18 with QueryCacheContext

use of com.hazelcast.map.impl.querycache.QueryCacheContext in project hazelcast by hazelcast.

the class NodeQueryCacheEventServiceTest method getSubscriberContext.

private static SubscriberContext getSubscriberContext(HazelcastInstance node) {
    MapService mapService = getNodeEngineImpl(node).getService(MapService.SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    return queryCacheContext.getSubscriberContext();
}
Also used : QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 19 with QueryCacheContext

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.getQueryCacheContext();
    queryCacheContext.setSubscriberContext(new TestClientSubscriberContext(queryCacheContext, eventCount, true));
}
Also used : ClientMapProxy(com.hazelcast.client.impl.proxy.ClientMapProxy) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) TestClientSubscriberContext(com.hazelcast.client.map.impl.querycache.subscriber.TestClientSubscriberContext)

Example 20 with QueryCacheContext

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.getQueryContext();
    queryCacheContext.setSubscriberContext(new TestClientSubscriberContext(queryCacheContext, eventCount, true));
}
Also used : ClientMapProxy(com.hazelcast.client.proxy.ClientMapProxy) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) TestClientSubscriberContext(com.hazelcast.client.map.querycache.subscriber.TestClientSubscriberContext)

Aggregations

QueryCacheContext (com.hazelcast.map.impl.querycache.QueryCacheContext)27 Accumulator (com.hazelcast.map.impl.querycache.accumulator.Accumulator)7 MapService (com.hazelcast.map.impl.MapService)5 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)5 PublisherContext (com.hazelcast.map.impl.querycache.publisher.PublisherContext)5 Sequenced (com.hazelcast.map.impl.querycache.event.sequence.Sequenced)4 QueryCacheEventService (com.hazelcast.map.impl.querycache.QueryCacheEventService)3 QueryCacheEventData (com.hazelcast.map.impl.querycache.event.QueryCacheEventData)3 ClientMapProxy (com.hazelcast.client.impl.proxy.ClientMapProxy)2 TestClientSubscriberContext (com.hazelcast.client.map.impl.querycache.subscriber.TestClientSubscriberContext)2 TestClientSubscriberContext (com.hazelcast.client.map.querycache.subscriber.TestClientSubscriberContext)2 ClientMapProxy (com.hazelcast.client.proxy.ClientMapProxy)2 Node (com.hazelcast.instance.impl.Node)2 AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)2 AccumulatorInfoSupplier (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfoSupplier)2 EventPublisherAccumulatorProcessor (com.hazelcast.map.impl.querycache.publisher.EventPublisherAccumulatorProcessor)2 MapPublisherRegistry (com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry)2 PublisherAccumulatorHandler (com.hazelcast.map.impl.querycache.publisher.PublisherAccumulatorHandler)2 PublisherRegistry (com.hazelcast.map.impl.querycache.publisher.PublisherRegistry)2 QueryCacheEndToEndProvider (com.hazelcast.map.impl.querycache.subscriber.QueryCacheEndToEndProvider)2