Search in sources :

Example 1 with InterceptorRegistry

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

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

the class PostJoinMapOperation method addMapInterceptors.

public void addMapInterceptors(MapContainer mapContainer) {
    InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry();
    List<MapInterceptor> interceptorList = interceptorRegistry.getInterceptors();
    Map<String, MapInterceptor> interceptorMap = interceptorRegistry.getId2InterceptorMap();
    Map<MapInterceptor, String> revMap = new HashMap<MapInterceptor, String>();
    for (Map.Entry<String, MapInterceptor> entry : interceptorMap.entrySet()) {
        revMap.put(entry.getValue(), entry.getKey());
    }
    InterceptorInfo interceptorInfo = new InterceptorInfo(mapContainer.getName());
    for (MapInterceptor interceptor : interceptorList) {
        interceptorInfo.addInterceptor(revMap.get(interceptor), interceptor);
    }
    interceptorInfoList.add(interceptorInfo);
}
Also used : InterceptorRegistry(com.hazelcast.map.impl.InterceptorRegistry) MapInterceptor(com.hazelcast.map.MapInterceptor) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) AbstractMap(java.util.AbstractMap)

Aggregations

MapInterceptor (com.hazelcast.map.MapInterceptor)2 InterceptorRegistry (com.hazelcast.map.impl.InterceptorRegistry)2 AbstractMap (java.util.AbstractMap)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 MapContainer (com.hazelcast.map.impl.MapContainer)1 MapService (com.hazelcast.map.impl.MapService)1 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)1 Indexes (com.hazelcast.query.impl.Indexes)1