Hey all,
I'm using JCS with a Remote Cache Server and a number of web servers.
Now and then I'll get a ConcurrentModificationException as two of my
servers attempt to update the same key in a particular region at the
same time. Is there any good way to avoid this? Preferably I'd like each
server to be able to update the cache, and use whichever is put in last
as the 'real' version.
I was thinking I could use some sort of locking with each server having
its own key to update, then before each update a server would check all
servers' lock keys and only once they were all clear would it perform
whatever update it was going to do. This seems really slow though, and I
really need all the performance I can get.
Here's the stacktrace if it helps:
java.util.ConcurrentModificationException
at java.util.ArrayList.writeObject(ArrayList.java:572)
at sun.reflect.GeneratedMethodAccessor142.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at
org.apache.jcs.utils.serialization.StandardSerializer.serialize(StandardSerializer.java:50)
at
org.apache.jcs.utils.serialization.SerializationConversionUtil.getSerializedCacheElement(SerializationConversionUtil.java:73)
at
org.apache.jcs.auxiliary.remote.RemoteCache.update(RemoteCache.java:207)
at
org.apache.jcs.engine.CacheAdaptor.handlePut(CacheAdaptor.java:91)
at
org.apache.jcs.engine.CacheEventQueue$PutEvent.doRun(CacheEventQueue.java:688)
at
org.apache.jcs.engine.CacheEventQueue$AbstractCacheEvent.run(CacheEventQueue.java:607)
at
org.apache.jcs.engine.CacheEventQueue$QProcessor.run(CacheEventQueue.java:575)
Thanks!
-Josh
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]