If that's the case, shouldn't a graceful shutdown be fine? Something like this:
public class MyThread implements Runnable {
private volatile Thread myThread;
public MyThread() {
...
Type: Posts; User: DuncanS
If that's the case, shouldn't a graceful shutdown be fine? Something like this:
public class MyThread implements Runnable {
private volatile Thread myThread;
public MyThread() {
...
As outlined here, ChristopherLowe's suggestions are your best bet for killing the thread abruptly, but I would wrap it in a ShutdownHook -
Runtime.getRuntime().addShutdownHook(new Thread() {...