[jboss-user] [JBossCache] - org.jboss.cache.lock.TimeoutException: write lock for / coul

bmozaffa@redhat.com do-not-reply at jboss.com
Thu Nov 29 20:59:38 EST 2007

Hi all,

I'm trying to use JBoss Cache with optimistic locking as 2nd level cache for hibernate. I have a test case where a multi-threaded client inserts new objects into the database, with a database auto-sequence primary key. My test case passes with no issues when using pessimistic locking, but as soon as I switch to optimistic locking, I get the following:

17:47:25,831 WARN  [TreeCache] replication failure with method_call optimisticPrepare; id:18(GlobalTransaction:<>:14, [_put; id:38(GlobalTransaction:<>:14, /EntityBean_jar,SimpleEntityBean/com/intuit/spc/bhp/entity/SimpleEntityBean/com.intuit.spc.bhp.entity.SimpleEntityBean#3144, item, CacheEntry(com.intuit.spc.bhp.entity.SimpleEntityBean)[Thu Nov 29 17:47:10 PST 2007,1234567890], true, org.jboss.ejb3.entity.OptimisticJBCCache$DataVersionAdapter at 1e3e4c5 [current=Thu Nov 29 17:47:10 PST 2007, previous=null, src=SingleTableEntityPersister(com.intuit.spc.bhp.entity.SimpleEntityBean)])], null,, false) exception
org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/, caller=GlobalTransaction:<>:14, lock=write owner=GlobalTransaction:<>:14 (activeReaders=0, activeWriter=WorkerThread#3[], waitingReaders=0, waitingWriters=1, waitingUpgrader=0)

Please note that I have 4 client threads (JMeter) sending requests in through a JSP that calls an SLSB, but there should be no concurrency issue, given that all request amount to database inserts and it's the same entity bean for all of them, thereby making the cache objects peers (one is not the parent of another). The error message implies that the cache is writing or updating something at the root, but I don't know why that would be.

My SLSB code looks like this:
			SimpleEntityBean entityBean = new SimpleEntityBean();
			return entityBean.getId();

Your thoughts / suggestions would be greatly appreciated!

Thanks, Babak

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109116#4109116

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109116

More information about the jboss-user mailing list