"Hi, Amigo!"
8
Task
Java Multithreading,
level 7,
lesson 6
Locked
Eliminating deadlock
Use a deadlock-avoidance strategy to avoid deadlock.
The main method is not tested.
Follow the example in the lessons.
Only make changes in safeMethod.
32
Task
Java Multithreading,
level 7,
lesson 6
Locked
Determining locking order
Implement the logic of the isLockOrderNormal method, which should determine:
whether the order of the synchronized blocks in the someMethodWithSynchronizedBlocks method matches
the order of the arguments passed to it.
If o1 is synchronized first and then o2, the method should return true.
16
Task
Java Multithreading,
level 7,
lesson 6
Locked
Eliminating deadlock using open calls
Synchronized methods that internally invoke the synchronized methods of other classes cause deadlock.
1. Move the synchronization from the method to the synchronized block, where you'll place only the necessary parts of the code.
2. Eliminate unnecessary method synchronization.
GO TO FULL VERSION