If your application code in WAS is repeatedly running into a deadlock situations and you want to be forewarned, you can use the ThreadMXBean exposed by the JVM and call these methods
java.lang.management.ThreadMXBean.findDeadlockedThreads()
java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()
java.lang.management.ThreadMXBean.findDeadlockedThreads()
java.lang.management.ThreadMXBean.findMonitorDeadlockedThreads()
If either of the two threads returns a non null value programmatically call a system dump and dump whatever other state you need to diagnose the problem. You can view the contents of the system dump in Eclipse Memory Analyzer Tool.
The House MD equivalent for WAS :-) Kevin Grigorenko has an application deadlockWatch.war that you can use to take a javacore, if there is a deadlock in order to capture the state of the system at the time of the deadlock.
There is no way around having to figure out a proper interval which balances catching it versus the overhead of the check. The default in this app is a 5 minute interval (30000 ms) and you can change that with -Dcom.ibm.deadlockWatch.DeadlockWatcherThread.sleepTime=N (where N is in milliseconds). Source code is included in the application if you'd like to modify it yourself.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.