so, lets say I have a thread that looks like this:
public run() {
boolean active = true;
while (active) {
//do some action that takes a really long time
}
}
Is there any way I can directly stop and destroy this thread in the middle of the action which takes a really long time to complete? Basically, I want to instantly kill this thread. The other way that I see is to set active to false, but the thread wont actually stop until it completes its current action.
It may be hard to imagine where this is a problem, but the action I'm speaking of is a ftp transfer of a very large file, using this thread. I need a way to abort the transfer, instantly. Suggestions?