|
|
|
|||
|
Reaquiring a LockThe Java runtime system allows a thread to re-acquire a monitor that it already holds because Java monitors are reentrant. Reentrant monitors are important because they eliminate the possibility of a single thread deadlocking itself on a monitor that it already holds.Consider this class:
Reentrant contains two synchronized methods: a and
b. The first synchronized method, a,
calls the other synchronized method, b.
When control enters method In systems that don't support reentrant monitors, this sequence of method calls would cause deadlock.here I am, in b() here I am, in a() | |||
|