How to check whether a thread has started in Java?
•
Java
See English answers > in Java, how do you determine if a thread is running? 8
I will start this post at some time
After a period of time, I need to check whether the thread has started?
So I can start at that point
My thread class is,
public class BasicChatListener extends Thread{ public void run(){ } }
Do I need to know if a particular thread of the basicchatlistener class is running? Because there are already multiple threads running in my application
How will our stack members help me
Solution
You can use thread Getstate () and use the corresponding states
Please note that when you read this status, it may have changed, but you may be able to determine what you are interested in Check this state diagram for available transformations
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码