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.
Asked: 2021-05-21 11:00:00 +0000
Seen: 8 times
Last updated: Nov 02 '21