public void stop() { command.stop(); if (thread != null) { thread.interrupt(); } }
public void run() { thread = Thread.currentThread(); try { if (command.isValid()) { command.execute(); } } catch (Exception e) { // Terminate other threads. stopThreads(e); } complete = true; if (exception == null) { threadCompleted(); } }