Ask Your Question
3

Do ThreadMXBean operations result in JVM STW, and is it reasonable to periodically invoke the findDeadlockedThreads method?

asked 2021-05-21 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-11-02 12:00:00 +0000

bukephalos gravatar image

Yes, ThreadMXBean operations can result in JVM stop-the-world pauses, especially if they involve suspending or resuming threads. It is generally recommended to use these operations sparingly and with caution, especially in production environments.

Regarding the findDeadlockedThreads method, invoking it periodically can help detect potential deadlocks in your application. However, it is important to note that this method also involves thread suspension, which can negatively impact application performance. Therefore, it is typically advised to use this method only when necessary, such as when troubleshooting specific issues related to thread synchronization or deadlocks. In general, it is a good practice to minimize the use of ThreadMXBean operations and to only apply them when there is a clear need for them.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-05-21 11:00:00 +0000

Seen: 8 times

Last updated: Nov 02 '21