struts-dev mailing list archives

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

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.

Darren

-----Original Message-----
From: Don Brown [mailto:mrdon@twdata.org] 
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.

Don

On 9/20/07, Shepherd, Darren S <darren.s.shepherd@citi.com> 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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message