// Path: webimageloader/src/main/java/com/webimageloader/util/ListenerFuture.java
// public class ListenerFuture implements Runnable {
//     public interface Task {
//         void run() throws Exception;
//     }
// 
//     private Task task;
//     private LoaderWork.Manager manager;
// 
//     public ListenerFuture(Task task, LoaderWork.Manager manager) {
//         this.task = task;
//         this.manager = manager;
//     }
// 
//     @Override
//     public void run() {
//         try {
//             task.run();
//         } catch (Throwable t) {
//             manager.deliverError(t);
//         }
//     }
// }


import java.io.Closeable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import com.webimageloader.util.ListenerFuture;
package com.webimageloader.loader;



public abstract class BackgroundLoader implements Loader, Closeable {
    private ExecutorService executor;

    public BackgroundLoader(ExecutorService executor) {
        this.executor = executor;
    }

    @Override
    public void load(final LoaderWork.Manager manager, final LoaderRequest request) {
// Path: webimageloader/src/main/java/com/webimageloader/util/ListenerFuture.java
// public class ListenerFuture implements Runnable {
//     public interface Task {
//         void run() throws Exception;
//     }
// 
//     private Task task;
//     private LoaderWork.Manager manager;
// 
//     public ListenerFuture(Task task, LoaderWork.Manager manager) {
//         this.task = task;
//         this.manager = manager;
//     }
// 
//     @Override
//     public void run() {
//         try {
//             task.run();
//         } catch (Throwable t) {
//             manager.deliverError(t);
//         }
//     }
// }


// Path: webimageloader/src/main/java/com/webimageloader/loader/BackgroundLoader.java
import java.io.Closeable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import com.webimageloader.util.ListenerFuture;

package com.webimageloader.loader;



public abstract class BackgroundLoader implements Loader, Closeable {
    private ExecutorService executor;

    public BackgroundLoader(ExecutorService executor) {
        this.executor = executor;
    }

    @Override
    public void load(final LoaderWork.Manager manager, final LoaderRequest request) {
        run(manager, new ListenerFuture.Task() {