struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shepherd, Darren S " <>
Subject RE: Multithreaded use of HashMap
Date Thu, 20 Sep 2007 15:31:46 GMT

Your right about OgnlUtils, that was a dumb mistake overlooking that.  I was actually more
concerned about the SpringObjectFactory.  I noticed it wasn't synchronized, but I'm concerned
about the performance of making it synchronized.  The ObjectFactory is accessed so frequently
that I personally think making it externally synchronized would impose a big performance impact.
 Do you agree?

Could I suggest that instead of using a HashMap, we could use a java.util.concurrent.ConcurrentHashMap.
 ConcurrentHashMap does not allow nulls though (not sure if that's an issue).

The same argument to use ConcurrentHashMap for SpringObjectFactory I think applies to changing
OgnlUtils to use ConcurrentHashMap instead of an externally synchronized HashMap.


-----Original Message-----
From: Don Brown [] 
Sent: Thursday, September 20, 2007 9:56 AM
To: Struts Developers List
Subject: Re: Multithreaded use of HashMap

OgnlUtil properly protects its caches by surrounding them in
synchronized blocks, but you are right, the SpringObjectFactory class
does not.  I fixed it in trunk.


On 9/20/07, Shepherd, Darren S <> wrote:
> I noticed two different cases where a HashMap is being used in a multithreaded read/write
manner.  As we all know the java HashMap implementation does not allow concurrent read/writes
that are not externally synchronized.  Is there some reason I should not be concerned?  The
classes are OgnlUtils and SpringObjectFactory.  Both classes are actually xworks API.  Is
xworks a different project?  Should this question be directed towards a different list?
> Darren

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message