Code example for ThreadPoolExecutor

0
     */ 
    private long nextSequenceNumber = 0;
 
    /** This cache uses a single background thread to evict entries. */ 
    final ThreadPoolExecutor executorService =
    new ThreadPoolExecutor(0, 1, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
    private final Callable<Void> cleanupCallable = new Callable<Void>() {
        public Void call() throws Exception { 
            synchronized (DiskLruCache.this) { 
                if (journalWriter == null) { 
                    return null; // Closed. 
                } 
                trimToSize(); 
                if (journalRebuildRequired()) { 
                    rebuildJournal(); 
                    redundantOpCount = 0; 
                } 
            } 
            return null; 
        } 
    };