Code example for ArrayBlockingQueue

0
 * Abstract service for remote APIs that handle app registration and user input. 
 */ 
public abstract class RemoteService extends Service {
    Context mContext;
 
    private final ArrayBlockingQueue<Runnable> mPoolQueue = new ArrayBlockingQueue<Runnable>(100);
    // TODO: Are these parameters okay? 
    private PausableThreadPoolExecutor mThreadPool = new PausableThreadPoolExecutor(2, 4, 10,
            TimeUnit.SECONDS, mPoolQueue);
 
    private final Object userInputLock = new Object();
 
    /** 
     * Override handleUserInput() to handle OKAY (1) and CANCEL (0). After handling the waiting 
     * threads will be notified and the queue resumed 
     */ 
    protected class UserInputCallback extends BaseCallback { 
 
        public void handleUserInput(Message msg) {
        }