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:<172.31.100.1:34099>:14, [_put; 
id:38(GlobalTransaction:<172.31.100.1:34099>: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, [EMAIL PROTECTED] [current=Thu Nov 29 
17:47:10 PST 2007, previous=null, 
src=SingleTableEntityPersister(com.intuit.spc.bhp.entity.SimpleEntityBean)])], 
null, 172.31.100.1:34099, false) exception
org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/, 
caller=GlobalTransaction:<172.31.100.1:34099>:14, lock=write 
owner=GlobalTransaction:<172.31.100.1:34101>:14 (activeReaders=0, 
activeWriter=WorkerThread#3[127.0.0.1:38225], 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();
                        
entityBean.setTimestamp(Calendar.getInstance().getTime());
                        em.persist(entityBean);
                        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
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to