commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "NM, Vijayakumar" <vijayakumar...@capgemini.com>
Subject RE: [JCS] ConcurrentModificationException
Date Fri, 27 Jan 2012 09:39:09 GMT
Thanks Daniel and Thomas,

Daniel, yes I suspect that is the case, i.e.. when I start writing into JCS cache, the underlying
object may be getting serialized or deserialized. Though I have a wrapper synchronized method
for putting objects into cache, but that is not helping me, is there any workaround to fix
this issue?

Regards,
Vijay

-----Original Message-----
From: Daniel Pitts [mailto:Daniel@coloraura.com] 
Sent: 26 January 2012 05:02
To: Commons Users List
Subject: Re: [JCS] ConcurrentModificationException

On 1/25/12 4:26 AM, Thomas Muller wrote:
> Hi,
>
> I don't know JCS at all, but the exception you get is the result of 
> one thread updating a collection (in your case a HashMap) whilst 
> another thread is iterating it. 
Actually, that exception can (and does) happen in single threaded 
applications, although that might not be the case here.
> This would happen even if the Map was decorated using the 
> Collections.synchronizedMap( myMap ) facility. To allow /true/ 
> concurrent access/updates to a Map, the 
> java.util.concurrent.ConcurrentHashMap (or another class implementing 
> the ConcurrentMap) must be deployed.
Using ConcurrentHashMap may be a heavy weight solution to a simple problem.


In general, if you are serializing an object graph, you should not be 
modifying that graph concurrently.

> May there is a way you can force JCS to use another Map implementation 
> than HashMap? Some factory method somewhere?
>
This looks like the HashMap is in the Object Model, unrelated to JCS.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org







This message contains information that may be privileged or confidential and is the property
of the Capgemini Group. It is 
intended only for the person to whom it is addressed. If you are not the intended recipient,
you are not authorized to 
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof.
If you receive this message 
in error, please notify the sender immediately and delete all copies of this message.
Mime
View raw message