Ejemplo n.º 1
0
  @Override
  public void run() throws Exception {
    Indexes indexes = mapContainer.getIndexes();
    Index index = indexes.addOrGetIndex(attributeName, ordered);

    final long now = getNow();
    final Iterator<Record> iterator = recordStore.iterator(now, false);
    SerializationService serializationService = getNodeEngine().getSerializationService();
    while (iterator.hasNext()) {
      final Record record = iterator.next();
      Data key = record.getKey();
      Object value = Records.getValueOrCachedValue(record, serializationService);
      QueryableEntry queryEntry = mapContainer.newQueryEntry(key, value);
      index.saveEntryIndex(queryEntry, null);
    }
  }
 @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());
       }
     }
   }
 }