Linked Questions
114 questions linked to/from How do you kill a Thread in Java?
20
votes
5
answers
114k
views
Java: How to stop thread? [duplicate]
Is there any way to stop another thread from OUTSIDE of the thread?
Like, if I ran a thread to run that thread and caused that thread to stop? Would it stop the other thread?
Is there a way to stop ...
4
votes
3
answers
23k
views
How to stop thread safely in android? [duplicate]
how can I stop threads safely?
downloadThread = new Thread(new Runnable() {
@Override
public void run() {
});
downloadThread.start();
}
4
votes
6
answers
782
views
How to stop a Java thread? [duplicate]
Possible Duplicate:
How do you kill a thread in Java?
How to start/stop/restart a thread in Java?
Thread has the following functions:
destroy()
stop()
suspend()
but they are all deprecated.
What ...
-3
votes
4
answers
11k
views
How to kill a thread on java? [duplicate]
I'm with a headache on killing a thread with java ...
I saw a lot of topics on stackoverflow and i didnt get them working on my code ...
Can someone explain me how am i able to kill a thread without ...
0
votes
3
answers
5k
views
Can Daemon Threads be killed? [duplicate]
I have a fair idea about what is Daemon Thread
But I want to know whether we can kill a Daemon Thread or when does a Daemon Thread get killed in Java?
2
votes
1
answer
2k
views
java - Check if a thread is interrupted without a loop or Thread.sleep() [duplicate]
I need to call an external method which sometimes takes indefinite time to complete.
void doMyStuff(){
// do my stuff
// work is being done by doStuff thread
externalMethod(); // This is ...
0
votes
0
answers
576
views
Kill blocked thread [duplicate]
Is there any way to interrupt blocking thread?
For example, in the following example the thread t2 would be blocked, however the interrupt call doesn't kill/interrupt the thread while it's blocked, ...
0
votes
2
answers
192
views
How to terminate a persistent thread in Java? [duplicate]
I want to create a thread to judge user code:
FutureTask<Integer> futureTask = new FutureTask(() -> run(type)); // run is a method
Thread thread = new Thread(futureTask);
thread.start();
As ...
0
votes
1
answer
285
views
How to stop a Thread in Java 8 [duplicate]
I'm working with threads in Java 8 and I'm using the next code:
Runnable runnable = () -> {
LOGGER.info(....);
someCode
};
Thread thread = new ...
0
votes
1
answer
193
views
How to stop currentThread in Java? [duplicate]
I am running parallel tests using TestNg and I would like to stop/kill a thread at certain points in my script. There are many layers to this script so simply throwing exceptions all the way back to ...
0
votes
1
answer
232
views
How to kill a Thread in Java instantly [duplicate]
I have a main Thread which is a Rest Endpoint.
I spawn a new Runnable in that end point and pass to the Executor service.
I make the main Thread wait on my Runnable by calling join() method.
Then in ...
2
votes
1
answer
169
views
How to terminate a Thread that wraps a function? [duplicate]
I'm doing a cours Exersice about Threads.
my question is how to terminate a Thread that wrap a function (and recives maximu time to be alive) when the function finished and return the result in java.
...
-1
votes
1
answer
156
views
Java kill thread after some time or when return data from him [duplicate]
How can I kill a thread if the time for him over or it return me the data?
how I start it
I need to pass a arg for him
0
votes
2
answers
91
views
How to pause the threads? [duplicate]
I have many threads (SwingWorker, Timer, Thread..) in different parts of the application.
I need to call one method which pause all these threads.
What is the best approach to do this?
Thanks
...
1
vote
0
answers
64
views
Thread methods deprecated [duplicate]
When am trying to stop a running thread, most of the methods to stop the thread are being shown "deprecated" in eclipse. I am using either of the methods stop(),destroy(),suspend(). Is there a new ...