Ejemplo n.º 1
0
 /** Closes this cache. Stored values will remain on the filesystem. */
 public synchronized void close() throws IOException {
   if (journalWriter == null) {
     return; // Already closed.
   }
   for (Entry entry : new ArrayList<Entry>(lruEntries.values())) {
     if (entry.currentEditor != null) {
       entry.currentEditor.abort();
     }
   }
   trimToSize();
   trimToFileCount();
   journalWriter.close();
   journalWriter = null;
 }
Ejemplo n.º 2
0
 public Void call() throws Exception {
   synchronized (DiskLruCache.this) {
     if (journalWriter == null) {
       return null; // Closed.
     }
     trimToSize();
     trimToFileCount();
     if (journalRebuildRequired()) {
       rebuildJournal();
       redundantOpCount = 0;
     }
   }
   return null;
 }
Ejemplo n.º 3
0
 /** Force buffered operations to the filesystem. */
 public synchronized void flush() throws IOException {
   checkNotClosed();
   trimToSize();
   trimToFileCount();
   journalWriter.flush();
 }