Search in sources :

Example 41 with MapServiceContext

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

the class DefaultRecordStore method readBackupData.

@Override
public Data readBackupData(Data key) {
    final long now = getNow();
    final Record record = getRecord(key);
    if (record == null) {
        return null;
    }
    // expiration has delay on backups, but reading backup data should not be affected by this delay.
    // this is the reason why we are passing `false` to isExpired() method.
    final boolean expired = isExpired(record, now, false);
    if (expired) {
        return null;
    }
    final MapServiceContext mapServiceContext = this.mapServiceContext;
    final Object value = record.getValue();
    mapServiceContext.interceptAfterGet(name, value);
    // this serialization step is needed not to expose the object, see issue 1292
    return mapServiceContext.toData(value);
}
Also used : Record(com.hazelcast.map.impl.record.Record) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 42 with MapServiceContext

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

the class PartitionWideEntryWithPredicateOperationFactory method getKeysFromIndex.

private Set<Data> getKeysFromIndex(NodeEngine nodeEngine) {
    // Do not use index in this case, because it requires full-table-scan.
    if (predicate == TruePredicate.INSTANCE) {
        return emptySet();
    }
    // get indexes
    MapService mapService = nodeEngine.getService(SERVICE_NAME);
    MapServiceContext mapServiceContext = mapService.getMapServiceContext();
    Indexes indexes = mapServiceContext.getMapContainer(name).getIndexes();
    // optimize predicate
    QueryOptimizer queryOptimizer = mapServiceContext.getQueryOptimizer();
    predicate = queryOptimizer.optimize(predicate, indexes);
    Set<QueryableEntry> querySet = indexes.query(predicate);
    if (querySet == null) {
        return emptySet();
    }
    List<Data> keys = null;
    for (QueryableEntry e : querySet) {
        if (keys == null) {
            keys = new ArrayList<Data>(querySet.size());
        }
        keys.add(e.getKeyData());
    }
    return keys == null ? Collections.<Data>emptySet() : newBuilder(keys).build();
}
Also used : Data(com.hazelcast.nio.serialization.Data) QueryOptimizer(com.hazelcast.query.impl.predicates.QueryOptimizer) MapService(com.hazelcast.map.impl.MapService) Indexes(com.hazelcast.query.impl.Indexes) MapServiceContext(com.hazelcast.map.impl.MapServiceContext) QueryableEntry(com.hazelcast.query.impl.QueryableEntry)

Example 43 with MapServiceContext

use of com.hazelcast.map.impl.MapServiceContext 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 44 with MapServiceContext

use of com.hazelcast.map.impl.MapServiceContext 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 45 with MapServiceContext

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

Aggregations

MapServiceContext (com.hazelcast.map.impl.MapServiceContext)63 MapService (com.hazelcast.map.impl.MapService)44 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)15 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)14 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)12 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)12 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)10 NodeEngine (com.hazelcast.spi.NodeEngine)10 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)7 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 MapContainer (com.hazelcast.map.impl.MapContainer)6 Data (com.hazelcast.nio.serialization.Data)6 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)5 MapStoreConfig (com.hazelcast.config.MapStoreConfig)4 SimpleEntryView (com.hazelcast.map.impl.SimpleEntryView)4 HashMap (java.util.HashMap)4 Config (com.hazelcast.config.Config)3 MapConfig (com.hazelcast.config.MapConfig)3 NearCacheConfig (com.hazelcast.config.NearCacheConfig)3 Node (com.hazelcast.instance.Node)3