Search in sources :

Example 6 with MapContainer

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

the class MapEventPublisherImpl method publishWanReplicationUpdate.

@Override
public void publishWanReplicationUpdate(String mapName, EntryView entryView) {
    MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
    MapReplicationUpdate replicationEvent = new MapReplicationUpdate(mapName, mapContainer.getWanMergePolicy(), entryView);
    mapContainer.getWanReplicationPublisher().publishReplicationEvent(SERVICE_NAME, replicationEvent);
}
Also used : MapReplicationUpdate(com.hazelcast.map.impl.wan.MapReplicationUpdate) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 7 with MapContainer

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

the class RemoveInterceptorOperation method run.

@Override
public void run() {
    mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
    mapContainer.getInterceptorRegistry().deregister(id);
}
Also used : MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapContainer(com.hazelcast.map.impl.MapContainer)

Example 8 with MapContainer

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

the class WriteBehindStateHolder method prepare.

void prepare(PartitionContainer container, int replicaIndex) {
    int size = container.getMaps().size();
    flushSequences = new HashMap<String, Queue<WriteBehindStore.Sequence>>(size);
    delayedEntries = new HashMap<String, List<DelayedEntry>>(size);
    for (Map.Entry<String, RecordStore> entry : container.getMaps().entrySet()) {
        RecordStore recordStore = entry.getValue();
        MapContainer mapContainer = recordStore.getMapContainer();
        MapConfig mapConfig = mapContainer.getMapConfig();
        if (mapConfig.getTotalBackupCount() < replicaIndex || !mapContainer.getMapStoreContext().isWriteBehindMapStoreEnabled()) {
            continue;
        }
        WriteBehindStore mapDataStore = (WriteBehindStore) recordStore.getMapDataStore();
        WriteBehindQueue<DelayedEntry> writeBehindQueue = mapDataStore.getWriteBehindQueue();
        List<DelayedEntry> entries = writeBehindQueue.asList();
        if (entries == null || entries.isEmpty()) {
            continue;
        }
        String mapName = entry.getKey();
        delayedEntries.put(mapName, entries);
        flushSequences.put(mapName, new ArrayDeque<WriteBehindStore.Sequence>(mapDataStore.getFlushSequences()));
    }
}
Also used : DelayedEntry(com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry) WriteBehindStore(com.hazelcast.map.impl.mapstore.writebehind.WriteBehindStore) MapContainer(com.hazelcast.map.impl.MapContainer) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) ArrayList(java.util.ArrayList) List(java.util.List) MapConfig(com.hazelcast.config.MapConfig) WriteBehindQueue(com.hazelcast.map.impl.mapstore.writebehind.WriteBehindQueue) Queue(java.util.Queue) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with MapContainer

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

the class PostJoinMapOperation method run.

@Override
public void run() throws Exception {
    MapService mapService = getService();
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    for (MapIndexInfo mapIndex : indexInfoList) {
        final MapContainer mapContainer = mapServiceContext.getMapContainer(mapIndex.mapName);
        final Indexes indexes = mapContainer.getIndexes();
        for (MapIndexInfo.IndexInfo indexInfo : mapIndex.lsIndexes) {
            indexes.addOrGetIndex(indexInfo.attributeName, indexInfo.ordered);
        }
    }
    for (InterceptorInfo interceptorInfo : interceptorInfoList) {
        final MapContainer mapContainer = mapServiceContext.getMapContainer(interceptorInfo.mapName);
        InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry();
        Map<String, MapInterceptor> interceptorMap = interceptorRegistry.getId2InterceptorMap();
        List<Map.Entry<String, MapInterceptor>> entryList = interceptorInfo.interceptors;
        for (Map.Entry<String, MapInterceptor> entry : entryList) {
            if (!interceptorMap.containsKey(entry.getKey())) {
                interceptorRegistry.register(entry.getKey(), entry.getValue());
            }
        }
    }
    createQueryCaches();
}
Also used : MapInterceptor(com.hazelcast.map.MapInterceptor) Indexes(com.hazelcast.query.impl.Indexes) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) MapContainer(com.hazelcast.map.impl.MapContainer) InterceptorRegistry(com.hazelcast.map.impl.InterceptorRegistry) MapService(com.hazelcast.map.impl.MapService) HashMap(java.util.HashMap) Map(java.util.Map) AbstractMap(java.util.AbstractMap)

Example 10 with MapContainer

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

the class QueryRunner method runPartitionScanQueryOnGivenOwnedPartition.

Result runPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) throws ExecutionException, InterruptedException {
    MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
    Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes());
    Collection<QueryableEntry> entries = partitionScanExecutor.execute(query.getMapName(), predicate, Collections.singletonList(partitionId));
    return populateTheResult(query, entries, Collections.singletonList(partitionId));
}
Also used : MapContainer(com.hazelcast.map.impl.MapContainer) QueryableEntry(com.hazelcast.query.impl.QueryableEntry) Predicate(com.hazelcast.query.Predicate)

Aggregations

MapContainer (com.hazelcast.map.impl.MapContainer)25 MapService (com.hazelcast.map.impl.MapService)10 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)6 Data (com.hazelcast.nio.serialization.Data)5 MapConfig (com.hazelcast.config.MapConfig)4 Record (com.hazelcast.map.impl.record.Record)4 Map (java.util.Map)4 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)3 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)3 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)3 QueryableEntry (com.hazelcast.query.impl.QueryableEntry)3 HashMap (java.util.HashMap)3 EntryView (com.hazelcast.core.EntryView)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 EntryViews.createSimpleEntryView (com.hazelcast.map.impl.EntryViews.createSimpleEntryView)2 Predicate (com.hazelcast.query.Predicate)2 ParallelTest (com.hazelcast.test.annotation.ParallelTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 Config (com.hazelcast.config.Config)1