[3146] in java-interest

home help back first fref pref prev next nref lref last post

Re: What object do "static synchronized" methods synchronize

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Wed Nov 1 18:38:54 1995

Date: Wed, 1 Nov 1995 11:43:54 -0800
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: rbk@ibeam.jf.intel.com
Cc: java-interest@java.Eng.Sun.COM


Hi Bob,

> I've verified that a method may be declared "static synchronized", and that
> the synchronization works (ie, remove the "synchronized" attribute and it
> races).  Now I'm curious: what object does such a method synchronize
> against?  The class?

Yes. It is the class. You can achieve the same effect by writing:

	synchronized (Class.forName("Foo")) {
	    ...
	}
	
Have fun,

	Arthur van Hoff
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post