public synchronized DownloadTask[] shutdown() {
        shutedDown = true;

        if (runningTask != null) runningTask.cancel();

        final DownloadTask[] tasks = new DownloadTask[taskList.size()];
        taskList.toArray(tasks);
        taskList.clear();

        return tasks;
    }
public synchronized DownloadTask [ ] shutdown ( ) { shutedDown = true ; if ( runningTask != null ) runningTask . cancel ( ) ; final DownloadTask [ ] tasks = new DownloadTask [ taskList . size ( ) ] ; taskList . toArray ( tasks ) ; taskList . clear ( ) ; return tasks ; }
Attempts to stop the working task, halts the processing of waiting tasks, and returns a list
of the tasks that were awaiting execution. These tasks are drained (removed) from the task
queue upon return from this method.