Code example for ThreadPoolExecutor

0
    // @formatter:off 
    private static final BlockingQueue<Runnable> sPoolWorkQueue = 
            new LinkedBlockingStack<Runnable>();
    // @formatter:on 
 
    public static final Executor LIFO_THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(
            CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS,
            sPoolWorkQueue, sThreadFactory);
 
    public static final Executor SERIAL_LIFO_EXECUTOR = new SerialLifoExecutor();
 
    private static final int MESSAGE_POST_RESULT = 0x1;
    private static final int MESSAGE_POST_PROGRESS = 0x2;
 
    private static final InternalHandler sHandler = new InternalHandler();
 
    private static volatile Executor sDefaultExecutor = SERIAL_LIFO_EXECUTOR;
    private final WorkerRunnable<Params, Result> mWorker;
    private final FutureTask<Result> mFuture;
 
    private volatile Status mStatus = Status.PENDING;