Search in sources :

Example 56 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class PostJoinMapOperation method createQueryCaches.

private void createQueryCaches() {
    MapService mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    QueryCacheContext queryCacheContext = mapServiceContext.getQueryCacheContext();
    PublisherContext publisherContext = queryCacheContext.getPublisherContext();
    MapPublisherRegistry mapPublisherRegistry = publisherContext.getMapPublisherRegistry();
    for (AccumulatorInfo info : infoList) {
        addAccumulatorInfo(queryCacheContext, info);
        PublisherRegistry publisherRegistry = mapPublisherRegistry.getOrCreate(info.getMapName());
        publisherRegistry.getOrCreate(info.getCacheName());
        // marker listener.
        mapServiceContext.addLocalListenerAdapter(new ListenerAdapter<IMapEvent>() {

            @Override
            public void onEvent(IMapEvent event) {
            }
        }, info.getMapName());
    }
}
Also used : MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) MapPublisherRegistry(com.hazelcast.map.impl.querycache.publisher.MapPublisherRegistry) PublisherRegistry(com.hazelcast.map.impl.querycache.publisher.PublisherRegistry) QueryCacheContext(com.hazelcast.map.impl.querycache.QueryCacheContext) AccumulatorInfo(com.hazelcast.map.impl.querycache.accumulator.AccumulatorInfo) IMapEvent(com.hazelcast.core.IMapEvent) MapService(com.hazelcast.map.impl.MapService) PublisherContext(com.hazelcast.map.impl.querycache.publisher.PublisherContext) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 57 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapGetInvalidationMetaDataOperation method getPartitionMetaDataGenerator.

private MetaDataGenerator getPartitionMetaDataGenerator() {
    MapService mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapNearCacheManager nearCacheManager = mapServiceContext.getMapNearCacheManager();
    return nearCacheManager.getInvalidator().getMetaDataGenerator();
}
Also used : MapNearCacheManager(com.hazelcast.map.impl.nearcache.MapNearCacheManager) MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 58 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapNearCacheStateHolder method prepare.

void prepare(PartitionContainer container, int replicaIndex) {
    MapService mapService = container.getMapService();
    MetaDataGenerator metaData = getPartitionMetaDataGenerator(mapService);
    int partitionId = container.getPartitionId();
    partitionUuid = metaData.getUuidOrNull(partitionId);
    ConcurrentMap<String, RecordStore> maps = container.getMaps();
    for (Map.Entry<String, RecordStore> entry : maps.entrySet()) {
        if (mapNameSequencePairs == emptyList()) {
            mapNameSequencePairs = new ArrayList(container.getMaps().size());
        }
        String mapName = entry.getKey();
        mapNameSequencePairs.add(mapName);
        mapNameSequencePairs.add(metaData.currentSequence(mapName, partitionId));
    }
}
Also used : RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) ArrayList(java.util.ArrayList) MapService(com.hazelcast.map.impl.MapService) MetaDataGenerator(com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map)

Example 59 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class MapReplicationOperation method getRecordStore.

RecordStore getRecordStore(String mapName) {
    final boolean skipLoadingOnRecordStoreCreate = true;
    MapService mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    return mapServiceContext.getRecordStore(getPartitionId(), mapName, skipLoadingOnRecordStoreCreate);
}
Also used : MapService(com.hazelcast.map.impl.MapService) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 60 with MapService

use of com.hazelcast.map.impl.MapService in project hazelcast by hazelcast.

the class WriteBehindStateHolder method writeData.

@Override
public void writeData(ObjectDataOutput out) throws IOException {
    MapService mapService = mapReplicationOperation.getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    out.writeInt(delayedEntries.size());
    for (Map.Entry<String, List<DelayedEntry>> entry : delayedEntries.entrySet()) {
        out.writeUTF(entry.getKey());
        List<DelayedEntry> delayedEntryList = entry.getValue();
        out.writeInt(delayedEntryList.size());
        for (DelayedEntry e : delayedEntryList) {
            Data key = mapServiceContext.toData(e.getKey());
            Data value = mapServiceContext.toData(e.getValue());
            out.writeData(key);
            out.writeData(value);
            out.writeLong(e.getStoreTime());
            out.writeInt(e.getPartitionId());
            out.writeLong(e.getSequence());
        }
    }
    out.writeInt(flushSequences.size());
    for (Map.Entry<String, Queue<WriteBehindStore.Sequence>> entry : flushSequences.entrySet()) {
        out.writeUTF(entry.getKey());
        Queue<WriteBehindStore.Sequence> queue = entry.getValue();
        out.writeInt(queue.size());
        for (WriteBehindStore.Sequence sequence : queue) {
            out.writeLong(sequence.getSequence());
            out.writeBoolean(sequence.isFullFlush());
        }
    }
}
Also used : Data(com.hazelcast.nio.serialization.Data) DelayedEntry(com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) WriteBehindStore(com.hazelcast.map.impl.mapstore.writebehind.WriteBehindStore) ArrayList(java.util.ArrayList) List(java.util.List) MapService(com.hazelcast.map.impl.MapService) HashMap(java.util.HashMap) Map(java.util.Map) WriteBehindQueue(com.hazelcast.map.impl.mapstore.writebehind.WriteBehindQueue) Queue(java.util.Queue)

Aggregations

MapService (com.hazelcast.map.impl.MapService)80 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)44 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)13 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)13 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)12 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)11 MapContainer (com.hazelcast.map.impl.MapContainer)10 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)10 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 QuickTest (com.hazelcast.test.annotation.QuickTest)9 Test (org.junit.Test)9 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)8 Config (com.hazelcast.config.Config)7 Before (org.junit.Before)7 Data (com.hazelcast.nio.serialization.Data)6 Map (java.util.Map)6 Address (com.hazelcast.nio.Address)5 IPartitionLostEvent (com.hazelcast.spi.partition.IPartitionLostEvent)5 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)4