public static synchronized void shutdown() { for (OMMapBufferEntry entry : new ArrayList<OMMapBufferEntry>(bufferPoolLRU)) { entry.close(); } bufferPoolLRU.clear(); bufferPoolPerFile.clear(); totalMemory = 0; }
/** * 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(); } }
/** 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(); } } }