Search in sources :

Example 1 with QueryCacheContext

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

the class MapClientAwareService method clientDisconnected.

@Override
public void clientDisconnected(String clientUuid) {
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    PublisherContext publisherContext = queryCacheContext.getPublisherContext();
    publisherContext.handleDisconnectedSubscriber(clientUuid);
}
Also used : QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

Example 2 with QueryCacheContext

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

the class AccumulatorConsumerOperation method run.

@Override
public void run() throws Exception {
    QueryCacheContext context = getQueryCacheContext();
    QueryCacheEventService queryCacheEventService = context.getQueryCacheEventService();
    EventPublisherAccumulatorProcessor processor = new EventPublisherAccumulatorProcessor(queryCacheEventService);
    AccumulatorHandler<Sequenced> handler = new PublisherAccumulatorHandler(context, processor);
    int processed = 0;
    do {
        Accumulator accumulator = accumulators.poll();
        if (accumulator == null) {
            break;
        }
        if (isLocal()) {
            // consume the accumulator if only this node is the owner
            // of accumulators partition
            publishAccumulator(processor, handler, accumulator);
        } else {
            // if the accumulator is not local, it should be a leftover
            // stayed after partition migrations and remove that accumulator
            removeAccumulator(context, accumulator);
        }
        processed++;
    } while (processed <= maxProcessableAccumulatorCount);
}
Also used : Accumulator(com.hazelcast.map.impl.querycache.accumulator.Accumulator) QueryCacheEventService(com.hazelcast.map.impl.querycache.QueryCacheEventService) EventPublisherAccumulatorProcessor(com.hazelcast.map.impl.querycache.publisher.EventPublisherAccumulatorProcessor) Sequenced(com.hazelcast.map.impl.querycache.event.sequence.Sequenced) PublisherAccumulatorHandler(com.hazelcast.map.impl.querycache.publisher.PublisherAccumulatorHandler) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext)

Example 3 with QueryCacheContext

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

the class ReadAndResetAccumulatorOperation method run.

@Override
public void run() throws Exception {
    QueryCacheContext context = getQueryCacheContext();
    Map<Integer, Accumulator> accumulators = getAccumulators(context, name, cacheName);
    Accumulator<Sequenced> accumulator = accumulators.get(getPartitionId());
    if (accumulator.isEmpty()) {
        return;
    }
    eventDataList = new ArrayList<Sequenced>(accumulator.size());
    for (Sequenced sequenced : accumulator) {
        eventDataList.add(sequenced);
    }
    accumulator.reset();
}
Also used : Accumulator(com.hazelcast.map.impl.querycache.accumulator.Accumulator) Sequenced(com.hazelcast.map.impl.querycache.event.sequence.Sequenced) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext)

Example 4 with QueryCacheContext

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);
}
Also used : QueryCacheRequest(com.hazelcast.map.impl.querycache.subscriber.QueryCacheRequest) QueryCacheRequests.newQueryCacheRequest(com.hazelcast.map.impl.querycache.subscriber.QueryCacheRequests.newQueryCacheRequest) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) ClientQueryCacheContext(com.hazelcast.client.impl.querycache.ClientQueryCacheContext)

Example 5 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.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