コード例 #1
0
ファイル: OMMapManager.java プロジェクト: cloudsmith/orientdb
 public static synchronized void shutdown() {
   for (OMMapBufferEntry entry : new ArrayList<OMMapBufferEntry>(bufferPoolLRU)) {
     entry.close();
   }
   bufferPoolLRU.clear();
   bufferPoolPerFile.clear();
   totalMemory = 0;
 }
コード例 #2
0
ファイル: OMMapManager.java プロジェクト: cloudsmith/orientdb
 /**
  * Removes the file.
  *
  * @throws IOException
  */
 public static synchronized void removeFile(final OFile file) throws IOException {
   final List<OMMapBufferEntry> entries = bufferPoolPerFile.remove(file);
   if (entries != null) {
     for (OMMapBufferEntry entry : entries) {
       bufferPoolLRU.remove(entry);
       entry.close();
     }
     entries.clear();
   }
 }
コード例 #3
0
ファイル: OMMapManager.java プロジェクト: cloudsmith/orientdb
 /** Flushes away all the buffers of closed files. This frees the memory. */
 public static synchronized void flush() {
   OMMapBufferEntry entry;
   for (Iterator<OMMapBufferEntry> it = bufferPoolLRU.iterator(); it.hasNext(); ) {
     entry = it.next();
     if (entry.file != null && entry.file.isClosed()) {
       removeEntry(it, entry);
       entry.close();
     }
   }
 }
コード例 #4
0
ファイル: OMMapManager.java プロジェクト: cloudsmith/orientdb
  /** Frees the mmap entry from the memory */
  private static boolean removeEntry(
      final Iterator<OMMapBufferEntry> it, final OMMapBufferEntry entry) {
    if (commitBuffer(entry)) {
      // COMMITTED: REMOVE IT
      it.remove();
      final List<OMMapBufferEntry> file = bufferPoolPerFile.get(entry.file);
      if (file != null) {
        file.remove(entry);
        if (file.isEmpty()) bufferPoolPerFile.remove(entry.file);
      }
      entry.buffer = null;

      totalMemory -= entry.size;
      return true;
    }
    return false;
  }