Java Reference
In-Depth Information
Listing 10.5. Lock-ordering Deadlock Between Cooperating Objects. Don't do this.
Taxi and Dispatcher in Listing 10.5 can be easily refactored to use open calls and thus
eliminate the deadlock risk. This involves shrinking the synchronized blocks to guard
only operations that involve shared state, as in Listing 10.6 . Very often, the cause of prob-
Search WWH ::




Custom Search