You can use Thread Analyzer to check for potential and actual deadlocks in your program. Thread Analyzer follows the same collect-analyze model that Oracle Solaris Studio Performance Analyzer uses.
There are three steps involved in using Thread Analyzer:
Compile the source code.
Create a deadlock-detection experiment.
Examine the experiment results.