Beispiel #1
0
 public void processFiles(ModuleChunk chunk, FileProcessor processor) throws Exception {
   for (Module module : chunk.getModules()) {
     final FSSnapshot snapshot = myFilesCache.get(module);
     if (!snapshot.processFiles(processor)) {
       return;
     }
   }
 }
Beispiel #2
0
  public static boolean isFileIndexed(
      VirtualFile file, ID<?, ?> indexName, final long indexCreationStamp) {
    if (file instanceof NewVirtualFile && file.isValid()) {
      synchronized (myTimestampsCache) {
        return myTimestampsCache.get(file).get(indexName) == indexCreationStamp;
      }
    }

    return false;
  }
Beispiel #3
0
 public static void update(
     final VirtualFile file, final ID<?, ?> indexName, final long indexCreationStamp) {
   try {
     if (file instanceof NewVirtualFile && file.isValid()) {
       synchronized (myTimestampsCache) {
         myTimestampsCache.get(file).set(indexName, indexCreationStamp);
       }
     }
   } catch (InvalidVirtualFileAccessException ignored /*ok to ignore it here*/) {
   }
 }
  @Override
  public void removeFrom(final K key, final V value) {
    try {
      final Collection collection = myCache.get(key);

      if (collection != NULL_COLLECTION) {
        if (collection.remove(value)) {
          myCache.remove(key);
          if (collection.isEmpty()) {
            myMap.remove(key);
          } else {
            myMap.put(key, (Collection<V>) collection);
          }
        }
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
 @Override
 public Collection<V> get(final K key) {
   final Collection<V> collection = myCache.get(key);
   return collection == NULL_COLLECTION ? null : collection;
 }