コード例 #1
0
ファイル: CompileContext.java プロジェクト: JetBrains/JPS
 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;
     }
   }
 }
 @Override
 public void close() {
   try {
     myCache.clear();
     myMap.close();
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
 @Override
 public void remove(final K key) {
   try {
     myCache.remove(key);
     myMap.remove(key);
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
コード例 #4
0
ファイル: IndexingStamp.java プロジェクト: jexp/idea2
  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;
  }
  @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);
    }
  }
コード例 #6
0
ファイル: IndexingStamp.java プロジェクト: jexp/idea2
 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 replace(K key, Collection<V> value) {
   try {
     myCache.remove(key);
     if (value == null || value.isEmpty()) {
       myMap.remove(key);
     } else {
       myMap.put(key, value);
     }
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
 @Override
 public void put(final K key, final Collection<V> value) {
   try {
     myCache.remove(key);
     myMap.appendData(
         key,
         new PersistentHashMap.ValueDataAppender() {
           public void append(DataOutput out) throws IOException {
             for (V v : value) {
               myValueExternalizer.save(out, v);
             }
           }
         });
   } catch (IOException e) {
     throw new RuntimeException(e);
   }
 }
コード例 #9
0
ファイル: IndexingStamp.java プロジェクト: jexp/idea2
 public static void flushCache() {
   synchronized (myTimestampsCache) {
     myTimestampsCache.clear();
   }
 }
 @Override
 public Collection<V> get(final K key) {
   final Collection<V> collection = myCache.get(key);
   return collection == NULL_COLLECTION ? null : collection;
 }
コード例 #11
0
ファイル: CompileContext.java プロジェクト: JetBrains/JPS
 public void clearFileCache() {
   myFilesCache.clear();
 }