| Author |
Synchronized Static Method
|
Sun LiWei
Ranch Hand
Joined: Aug 10, 2002
Posts: 49
|
|
I am confused by synchronized on static method,just like this: My question is: Does the object pool synchronize??? In my mind,synchronized on method is the same as But in static method,the keyword "this" is not allowed.So,what exactly "synchronized static method()" mean???
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
When you synchronize on a static method you are placing a lock on the class for the duration of the static method. -Barry
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
Santosh Terkhedkar
Greenhorn
Joined: Mar 18, 2001
Posts: 2
|
posted

0
|
Hi Visit this link http://www.javaworld.com/javaworld/jw-04-1999/jw-04-toolbox.html read critical section in java Threads. I think this will certainly help you solve your problem. Cheers, Santosh Terkhedkar.
|
 |
Valentin Crettaz
Gold Digger
Sheriff
Joined: Aug 26, 2001
Posts: 7610
|
|
synchronizing a static method locks on the java.lang.Class object representing the class, for instance in: is the same as
|
SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
|
 |
Jose Botella
Ranch Hand
Joined: Jul 03, 2001
Posts: 2120
|
|
|
When a class or interface is loaded a java.lang.Class instance is created to represent it. You can access references to them via the Class literals
|
SCJP2. Please Indent your code using UBB Code
|
 |
 |
|
|
subject: Synchronized Static Method
|
|
|