| Author |
How is locking perfomed
|
Kalyan Anand
Ranch Hand
Joined: Feb 07, 2007
Posts: 194
|
|
In this case how the JVM performs lock. 1. When the first synchronzied method is entered, on which objects it holds the lock. Only "this" or "this" as well as "super" ? 2. When the super class method is executed, on which object the lock is held ?
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16680
|
|
1. When the first synchronzied method is entered, on which objects it holds the lock. Only "this" or "this" as well as "super" ?
There is no such a thing as a "super" object. The super keyword is used to access the parts of the "this" object that is inherited from the super type. An instance is only one object.
2. When the super class method is executed, on which object the lock is held ?
In the example you provided, it is the "this" object. But as already mentioned, there is no such a thing as a "super" object. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Kalyan Anand
Ranch Hand
Joined: Feb 07, 2007
Posts: 194
|
|
Thanks Henry. I get it.
|
 |
 |
|
|
subject: How is locking perfomed
|
|
|