Code example for Queue

Methods: clear

0
        mExecutor.submit(new TaskRunner<Params, Progress, Result>(this));
    } 
 
    public synchronized void stop() { 
        mTaskQueue.clear();
        mParamQueue.clear();
        mExecutor.shutdownNow();
        mExecutor = null;
        if (mCurrentTaskRef != null) {
            AsyncTask<Params, Progress, Result> currentTask = mCurrentTaskRef.get();
            if (currentTask != null) {
                currentTask.cancel(true);
            } 
        } 
    } 
 
    private static class TaskRunner<Params, Progress, Result> implements Runnable {
        WeakReference<TaskQueue<Params, Progress, Result>> mTaskQueueRef;
 
        public TaskRunner(TaskQueue<Params, Progress, Result> taskQueue) {
            mTaskQueueRef = new WeakReference<TaskQueue<Params, Progress, Result>>(taskQueue);