Search in sources :

Example 11 with AccumulatorInfo

use of com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo in project hazelcast by hazelcast.

the class MapPublisherCreateMessageTask method createInvocations.

private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
    final OperationServiceImpl operationService = nodeEngine.getOperationService();
    for (MemberImpl member : members) {
        Predicate predicate = serializationService.toObject(parameters.predicate);
        AccumulatorInfo accumulatorInfo = AccumulatorInfo.toAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, false, parameters.populate, parameters.coalesce);
        PublisherCreateOperation operation = new PublisherCreateOperation(accumulatorInfo);
        operation.setCallerUuid(endpoint.getUuid());
        Address address = member.getAddress();
        InvocationBuilder invocationBuilder = operationService.createInvocationBuilder(SERVICE_NAME, operation, address);
        Future future = invocationBuilder.invoke();
        futures.add(future);
    }
}
Also used : Address(com.hazelcast.cluster.Address) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) Future(java.util.concurrent.Future) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) InvocationBuilder(com.hazelcast.spi.impl.operationservice.InvocationBuilder) PublisherCreateOperation(com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation) OperationServiceImpl(com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl) Predicate(com.hazelcast.query.Predicate)

Example 12 with AccumulatorInfo

use of com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo in project hazelcast by hazelcast.

the class ClientQueryCacheContext method recreateAllCaches.

public void recreateAllCaches() {
    // Since query cache is lost we are firing event lost event for each cache and for each partition
    QueryCacheFactory queryCacheFactory = subscriberContext.getQueryCacheFactory();
    Map<String, SubscriberRegistry> registryMap = subscriberContext.getMapSubscriberRegistry().getAll();
    for (SubscriberRegistry subscriberRegistry : registryMap.values()) {
        Map<String, Accumulator> accumulatorMap = subscriberRegistry.getAll();
        for (Accumulator accumulator : accumulatorMap.values()) {
            AccumulatorInfo info = accumulator.getInfo();
            String cacheId = info.getCacheId();
            InternalQueryCache queryCache = queryCacheFactory.getOrNull(cacheId);
            if (queryCache != null) {
                queryCache.recreate();
            }
        }
    }
}
Also used : QueryCacheFactory(com.hazelcast.map.impl.querycache.subscriber.QueryCacheFactory) Accumulator(com.hazelcast.map.impl.querycache.accumulator.Accumulator) SubscriberRegistry(com.hazelcast.map.impl.querycache.subscriber.SubscriberRegistry) InternalQueryCache(com.hazelcast.map.impl.querycache.subscriber.InternalQueryCache) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)

Example 13 with AccumulatorInfo

use of com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo in project hazelcast by hazelcast.

the class CoalescingPublisherAccumulator method accumulate.

@Override
public void accumulate(QueryCacheEventData eventData) {
    setSequence(eventData);
    getBuffer().add(eventData);
    AccumulatorInfo info = getInfo();
    if (!info.isPublishable()) {
        return;
    }
    poll(handler, info.getBatchSize());
    poll(handler, info.getDelaySeconds(), SECONDS);
}
Also used : AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)

Example 14 with AccumulatorInfo

use of com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo in project hazelcast by hazelcast.

the class DefaultPublisherContext method removePartitionAccumulatorRegistry.

private PartitionAccumulatorRegistry removePartitionAccumulatorRegistry(PartitionAccumulatorRegistry registry) {
    AccumulatorInfo info = registry.getInfo();
    String mapName = info.getMapName();
    String cacheId = info.getCacheId();
    MapPublisherRegistry mapPublisherRegistry = getMapPublisherRegistry();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(mapName);
    if (publisherRegistry == null) {
        return null;
    }
    return publisherRegistry.remove(cacheId);
}
Also used : AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)

Example 15 with AccumulatorInfo

use of com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo in project hazelcast by hazelcast.

the class NonStopPublisherAccumulator method accumulate.

@Override
public void accumulate(Sequenced eventData) {
    super.accumulate(eventData);
    AccumulatorInfo info = getInfo();
    if (!info.isPublishable()) {
        return;
    }
    poll(handler, 0, TimeUnit.SECONDS);
}
Also used : AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)

Aggregations

AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)21 PublisherCreateOperation (com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation)4 Address (com.hazelcast.cluster.Address)3 MapPublisherRegistry (com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry)3 PartitionAccumulatorRegistry (com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry)3 PublisherContext (com.hazelcast.map.impl.querycache.publisher.PublisherContext)3 PublisherRegistry (com.hazelcast.map.impl.querycache.publisher.PublisherRegistry)3 Predicate (com.hazelcast.query.Predicate)3 Future (java.util.concurrent.Future)3 MemberImpl (com.hazelcast.cluster.impl.MemberImpl)2 ArrayList (java.util.ArrayList)2 ClientEndpoint (com.hazelcast.client.ClientEndpoint)1 MapAssignAndGetUuidsOperation (com.hazelcast.client.impl.protocol.task.map.MapAssignAndGetUuidsOperation)1 MapAssignAndGetUuidsOperationFactory (com.hazelcast.client.impl.protocol.task.map.MapAssignAndGetUuidsOperationFactory)1 QueryCacheConfig (com.hazelcast.config.QueryCacheConfig)1 MemberImpl (com.hazelcast.instance.MemberImpl)1 IndexIterationPointer (com.hazelcast.internal.iteration.IndexIterationPointer)1 LocalRecordStoreStatsImpl (com.hazelcast.internal.monitor.impl.LocalRecordStoreStatsImpl)1 BatchNearCacheInvalidation (com.hazelcast.internal.nearcache.impl.invalidation.BatchNearCacheInvalidation)1 SingleNearCacheInvalidation (com.hazelcast.internal.nearcache.impl.invalidation.SingleNearCacheInvalidation)1