...
To avoid deadlock, locks should be acquired and released in the same order and synchronization should be limited to where it is absolutely necessary. For instance, to avoid deadlocks in an applet, the paint()
, dispose()
, stop()
, destroy()
methods in an applet should not be synchronized because they are always called and used from dedicated threads.
...