Java list of waiting threads

前端 未结 3 1107
忘掉有多难
忘掉有多难 2021-02-15 12:43

Is there a way to get a list of waiting threads/number of waiting threads on an object?

3条回答
  •  伪装坚强ぢ
    2021-02-15 13:12

    If you are on JDk 1.6 then ManagementFactory.getThreadMXBean() is the best way to find out about all the threads waiting on object For JDK before 1.6 you can use thread group to find out all the threads and then inspect thread stack to find out about object on which they are waiting.

提交回复
热议问题