I have a long-running task that gets launched in a SwingWorker thread from my GUI when the user presses a button. However, I'd like the user to be able to kill that long running-task with a "Stop" button. The problems I'm running into are that 1) my long running task isn't in a loop, it's just a once-and-done long task. 2) the task that gets done is abstracted away, so all I call is "executeTask()" and that sets all the processing motion.
Unfortunately, it doesn't seem like SwingWorker.interrupt() gets me out of this situation. Basically, I just want to tell the thread to stop processing immediately, no matter what. Is there a way to do this (I've looked into using a Thread object and calling Thread.stop, but the Java 5 API has deprecated that).
Hi. What my thread is doing is a combination of those things. It does some I/O operations, database retrievals and some massive calculations. I wanted to avoid adding interrupt handlers into EVERY step of each subtask. I really just want kill the thread in its tracks.