Code example for ThreadPoolExecutor

Methods: submit

0
     * Changes the maximum number of bytes the cache can store and queues a job 
     * to trim the existing store, if necessary. 
     */ 
    public synchronized void setMaxSize(long maxSize) {
        this.maxSize = maxSize;
        executorService.submit(cleanupCallable);
    } 
 
    /** 
     * Returns the number of bytes currently being used to store the values in 
     * this cache. This may be greater than the max size if a background 
     * deletion is pending. 
     */ 
    public synchronized long size() { 
        return size;
    } 
 
    private synchronized void completeEdit(Editor editor, boolean success) throws IOException {
        Entry entry = editor.entry;
        if (entry.currentEditor != editor) {
            throw new IllegalStateException();