Search in sources :

Example 16 with PublisherContext

use of com.hazelcast.map.impl.querycache.publisher.PublisherContext 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)

Example 17 with PublisherContext

use of com.hazelcast.map.impl.querycache.publisher.PublisherContext in project hazelcast by hazelcast.

the class MapMigrationAwareService method commitMigration.

@Override
public void commitMigration(PartitionMigrationEvent event) {
    migrateIndex(event);
    if (SOURCE == event.getMigrationEndpoint()) {
        clearMapsHavingLesserBackupCountThan(event.getPartitionId(), event.getNewReplicaIndex());
        getMetaDataGenerator().removeUuidAndSequence(event.getPartitionId());
    } else if (DESTINATION == event.getMigrationEndpoint()) {
        if (event.getNewReplicaIndex() != 0) {
            getMetaDataGenerator().regenerateUuid(event.getPartitionId());
        }
    }
    PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(event.getPartitionId());
    for (RecordStore recordStore : partitionContainer.getAllRecordStores()) {
        // in case the record store has been created without loading during migration trigger again
        // if loading has been already started this call will do nothing
        recordStore.startLoading();
    }
    mapServiceContext.reloadOwnedPartitions();
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    PublisherContext publisherContext = queryCacheContext.getPublisherContext();
    if (event.getMigrationEndpoint() == MigrationEndpoint.SOURCE) {
        int partitionId = event.getPartitionId();
        flushAccumulator(publisherContext, partitionId);
        removeAccumulator(publisherContext, partitionId);
    }
}
Also used : RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext) MigrationEndpoint(com.hazelcast.spi.partition.MigrationEndpoint)

Aggregations

PublisherContext (com.hazelcast.map.impl.querycache.publisher.PublisherContext)17 MapPublisherRegistry (com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry)9 PublisherRegistry (com.hazelcast.map.impl.querycache.publisher.PublisherRegistry)9 QueryCacheContext (com.hazelcast.map.impl.querycache.QueryCacheContext)4 PartitionAccumulatorRegistry (com.hazelcast.map.impl.querycache.publisher.PartitionAccumulatorRegistry)4 AccumulatorInfo (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo)3 AccumulatorInfoSupplier (com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfoSupplier)3 MapListenerRegistry (com.hazelcast.map.impl.querycache.publisher.MapListenerRegistry)2 QueryCacheListenerRegistry (com.hazelcast.map.impl.querycache.publisher.QueryCacheListenerRegistry)2 IMapEvent (com.hazelcast.core.IMapEvent)1 MapService (com.hazelcast.map.impl.MapService)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 AccumulatorConsumerOperation (com.hazelcast.map.impl.operation.AccumulatorConsumerOperation)1 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)1 Operation (com.hazelcast.spi.Operation)1 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)1 MigrationEndpoint (com.hazelcast.spi.partition.MigrationEndpoint)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1