...
Additionally, synchronization should be limited to cases where it is absolutely necessary. For example, the paint()
, dispose()
, stop()
, and destroy()
methods should never be synchronized in an applet because they are always called and used from dedicated threads. The Thread.stop()
and Thread.destroy()
methods are deprecated. For more information, see guideline rule THI05-J. Do not use Thread.stop() to terminate threads.
This guideline rule also applies to programs that need to work with a limited set of resources. For example, liveness issues can arise when two or more threads are waiting for each other to release resources such as database connections. These issues can be resolved by letting each waiting thread retry the operation at random intervals, until they succeed in acquiring the resource successfully.
...
SureLogic Flashlight can detect violations of this guidelinerule. It flags both the noncompliant code examples by specifying: "potential for deadlock."
...
Any vulnerabilities resulting from the violation of this guideline rule are listed on the CERT website.
...