Linked Questions

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(); }
Srinivas's user avatar
  • 1,706
7 votes
6 answers
2k views

How to safely close all threads before exit [duplicate]

I have an application that starts a few threads, eventually a thread may need to exit the entire application, however other threads may be in the middle of a task so I'd like to let them continue ...
Royal Wares's user avatar
  • 1,252
2 votes
1 answer
4k views

How to stop new Thread(new Runnable()) [duplicate]

How can I stop new Thread(new Runnable()).run I am new in android development :D, and I need your help :) I have this code and I would like to stop it after executing new Thread(new Runnable(...
Abubaker Gaber's user avatar
-1 votes
2 answers
875 views

How to stop a thread from inside? [duplicate]

Consider this code :- class A { Thread t = new Thread() { @Override public void run() { super.run(); // Tons of statements.... (Set 1) ...
Hokkyokusei's user avatar
  • 1,160
2 votes
0 answers
1k views

How to stop other Thread execution immediately? [duplicate]

Possible Duplicate: How to kill a thread immediately from another thread in java? How to properly stop the Thread in Java I need a way to stop another Thread execution ass needed just on time, ...
Soheil's user avatar
  • 1,676
1 vote
3 answers
665 views

How to stop a thread as soon as a certain amount of time expires? [duplicate]

I am having a problem trying to stop a thread instantly after a certain amount of time has elapsed, because thread.stop and similar others have been depreciated. The thread that I am trying to stop ...
user2510325's user avatar
2 votes
1 answer
217 views

Kill or Destroy or Exit Thread in Java [duplicate]

I create Thread in java, I want to kill or destroy or exit it and restart the same thread again. There are properties to kill or destroy thread but are deprecated now. Here is may same thread code `...
Farooq Awan's user avatar
-1 votes
2 answers
183 views

How do I properly stop the thread when a JNI code error occurs? [duplicate]

I have seen the How to properly stop the Thread in Java?. But there is no try&catch in C. I call a JNI function in a thread. I want to stop the thread when something goes wrong. What should I ...
loRe's user avatar
  • 3
0 votes
1 answer
136 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 ...
mastercool's user avatar
4 votes
1 answer
103 views

How to terminate child thread from main [duplicate]

I am trying to terminate the child thread, that's waiting for the input from the server. I've tried to do it with the flag, but it stops on the message = serverReader.readLine() && !isClosed(),...
Anton Barinov's user avatar
2 votes
0 answers
105 views

How to Stop Thread [duplicate]

I want to stop my thread if record were fetched please help me out. Here is my code. if (dialog==null) { dialog = ProgressDialog.show(AgentProgress.this, "", "Fetching ...
AZEEM AHMED's user avatar
0 votes
1 answer
70 views

Thread continuing even though it's declared null JAVA [duplicate]

maybe someone can help me- in an applet I declared instances of two threads, started them, and made a "stop" button that declares them null. In the thread classes, I made a while (this != null), and ...
TryingToCode's user avatar
2 votes
1 answer
66 views

Thread runs an infinite operation which I have no control over. How to stop it? [duplicate]

so I am making a java code testing web application and I am running each code execution in a seperate thread. The problem is that sometimes tests have a time limit or the student just writes an ...
Danijel Maraž's user avatar
0 votes
0 answers
69 views

Java : how to end and get out from inheritIO process [duplicate]

I have a class file look like below: import java.util.*; import java.io.*; public class GnuPG { public GnuPG() { } public static void doDecrypt(String strInput, String strOutput, ...
Teddybugs's user avatar
  • 1,224
0 votes
0 answers
58 views

Java interrupting thread [duplicate]

I have code like below. I have the following problem: I must stop Thread t, but inside is a method which suspends the thread in one place for long time. So when I'm trying to stop it, it stops after ...
Matt's user avatar
  • 1

15 30 50 per page
1
2 3 4 5 6