...
Code Block | ||
---|---|---|
| ||
final class ControlledStop implements Runnable { @Override public void run() { // recordRecord current thread, so others can interrupt it myThread = currentThread(); while (!Thread.interrupted()) { try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } public void shutdown(Thread th) { th.interrupt(); } } |
...