The synch. blocks do only allow one thread through that section at a time which may be the intended behavior. It still seems like the member variable Maps should be synchronized. Lack of sleep has some negative affects sometimes...

Dave






From: "David Graham" <[EMAIL PROTECTED]>
Reply-To: "Struts Developers List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Synchronized blocks?
Date: Mon, 27 Jan 2003 22:33:39 -0700

Maybe I'm displaying gross ignorance here but AFAIK a synchronized block grabs the object's monitor and blocks other threads from calling *synchronized* methods on that object, right? Unsynchronized methods on that object can be called at will.

I'm looking at LookupDispatchAction for PR #16019 and it has some strange synchronized blocks. It synchronizes on HashMap objects which contain no synchronized methods. Can anyone explain this to me?

I believe the Maps should be defined as Collections.synchronizedMap(new HashMap()); This alleviates the need for one of the synchronized blocks but the other is still needed because it Iterates over the key Set.

Thanks,
Dave





_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to