Search in sources :

Example 6 with AccumulatorInfo

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

the class MapPostJoinAwareService method getAccumulatorInfoList.

private List<AccumulatorInfo> getAccumulatorInfoList() {
    List<AccumulatorInfo> infoList = new ArrayList<>();
    PublisherContext publisherContext = mapServiceContext.getQueryCacheContext().getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    Map<String, PublisherRegistry> cachesOfMaps = mapPublisherRegistry.getAll();
    Collection<PublisherRegistry> publisherRegistries = cachesOfMaps.values();
    for (PublisherRegistry publisherRegistry : publisherRegistries) {
        Collection<PartitionAccumulatorRegistry> partitionAccumulatorRegistries = publisherRegistry.getAll().values();
        for (PartitionAccumulatorRegistry accumulatorRegistry : partitionAccumulatorRegistries) {
            AccumulatorInfo info = accumulatorRegistry.getInfo();
            infoList.add(info);
        }
    }
    return infoList;
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PartitionAccumulatorRegistry(com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) ArrayList(java.util.ArrayList) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

Example 7 with AccumulatorInfo

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

the class SubscriberAccumulator method getQueryCache.

private InternalQueryCache getQueryCache() {
    AccumulatorInfo info = getInfo();
    String cacheId = info.getCacheId();
    SubscriberContext subscriberContext = context.getSubscriberContext();
    QueryCacheFactory queryCacheFactory = subscriberContext.getQueryCacheFactory();
    return queryCacheFactory.getOrNull(cacheId);
}
Also used : AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)

Example 8 with AccumulatorInfo

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

the class MapPublisherCreateWithValueMessageTask method createPublishersAndGetSnapshotOf.

private List<Future> createPublishersAndGetSnapshotOf(Collection<MemberImpl> members) {
    List<Future> futures = new ArrayList<Future>(members.size());
    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, true, 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);
    }
    return futures;
}
Also used : Address(com.hazelcast.cluster.Address) MemberImpl(com.hazelcast.cluster.impl.MemberImpl) ArrayList(java.util.ArrayList) 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 9 with AccumulatorInfo

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

the class MapPublisherCreateWithValueMessageTask method createInvocations.

private void createInvocations(Collection<MemberImpl> members, List<Future> futures) {
    final InternalOperationService operationService = nodeEngine.getOperationService();
    final ClientEndpoint endpoint = getEndpoint();
    for (MemberImpl member : members) {
        Predicate predicate = serializationService.toObject(parameters.predicate);
        AccumulatorInfo accumulatorInfo = AccumulatorInfo.createAccumulatorInfo(parameters.mapName, parameters.cacheName, predicate, parameters.batchSize, parameters.bufferSize, parameters.delaySeconds, true, 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.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) Future(java.util.concurrent.Future) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) InvocationBuilder(com.hazelcast.spi.InvocationBuilder) ClientEndpoint(com.hazelcast.client.ClientEndpoint) PublisherCreateOperation(com.hazelcast.map.impl.querycache.subscriber.operation.PublisherCreateOperation) Predicate(com.hazelcast.query.Predicate)

Example 10 with AccumulatorInfo

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

the class AccumulatorConsumerOperation method removeAccumulator.

private void removeAccumulator(QueryCacheContext context, Accumulator accumulator) {
    PublisherContext publisherContext = context.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    AccumulatorInfo info = accumulator.getInfo();
    String mapName = info.getMapName();
    String cacheName = info.getCacheName();
    PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrNull(mapName);
    if (publisherRegistry == null) {
        return;
    }
    PartitionAccumulatorRegistry partitionAccumulatorRegistry = publisherRegistry.getOrNull(cacheName);
    if (partitionAccumulatorRegistry == null) {
        return;
    }
    partitionAccumulatorRegistry.remove(getPartitionId());
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PartitionAccumulatorRegistry(com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext)

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