Is there any way to check if a given thread is sleeping?
You can call Thread.getState()
on and check if the state is TIMED_WAITING
.
Note, however that TIMED_WAITING
doesn't necessarily mean that the thread called sleep()
, it could also be waiting in a Object.wait(long)
call or something similar.