JBoss Community

Re: JBoss cache / concurrent creation event

created by alex soto in JBoss Cache - View the full discussion

I am experiencing the same issue.  I think this is caused by use of optimistic locking mode for the Hibernate 2nd level cache configuration.  Two threads try to add the same element to the cache at about the same time.  Once the second thread completes the transaction, the first one had already added the element to the cache and the transaction is aborted. 

 

I suppose it would not happen if the lock (JBoss cache) locking scheme is changed to pessimistic, but that will result in less throughput. 

 

My question really is about how and or when Hibernate uses the new JBoss cache method "putForExternalRead"  which should silently return if the node is already in the cache.  Anybody?

Reply to this message by going to Community

Start a new discussion in JBoss Cache at Community