Code example for ThreadPoolExecutor

    private static final BlockingQueue<Runnable> sPoolWorkQueue = new LinkedBlockingQueue<Runnable>(10);
     * An {@link Executor} that can be used to execute tasks in parallel. 
    public static final Executor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE,
            TimeUnit.SECONDS, sPoolWorkQueue, sThreadFactory,
            new ThreadPoolExecutor.DiscardOldestPolicy());
     * An {@link Executor} that executes tasks one at a time in serial 
     * order.  This serialization is global to a particular process. 
    public static final Executor SERIAL_EXECUTOR = new SerialExecutor();
    public static final Executor DUAL_THREAD_EXECUTOR =Executors.newFixedThreadPool(3, sThreadFactory);
    private static final int MESSAGE_POST_RESULT = 0x1;
    private static final int MESSAGE_POST_PROGRESS = 0x2;
Experience pair programming with AI  Get Codota for Java