if (waitingTasks.size() > 0) {
ThreadPoolExecutor tmp = (ThreadPoolExecutor) Executors.newFixedThreadPool(waitingTasks.size() * 2);
tmp.setThreadFactory(new TaskThreadFactory());
for (Iterator<Runnable> it = waitingTasks.iterator(); it.hasNext();) {
TestableTask runnable = (TestableTask) it.next();
runnable.setTestMode(true);
runnable.setTestExitValue(EXIT_VAL_CMDEXEC_INTERRUPTED);
runnable.setTestOutput(new Vector<String>());
try {
Debug.trace("Cancel task: " + runnable.getTaskName());
tmp.execute(runnable);
tmp.remove(runnable);
} catch (Exception e) {
Debug.error("Failed to cancel task: " + runnable.getTaskName());
}
}
}
} catch (Exception e) {
e.printStackTrace();