How can I access Thread object that is executing given Runnable? What I’d like to do is to call sleep() from within run() method.
How can I access Thread object that is executing given Runnable ? What I’d
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you need to sleep within a
Runnable, you can simply callThread.sleep();inside therunmethod.To access the thread that is running the
Runnable, you can callThread.currentThread(), but that is not necessary to call thesleepmethod, which is static.