These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Order of lock acquisition - pessimistick locking - deadlock
PostPosted: Sat May 16, 2009 12:48 pm 
Newbie

Joined: Fri May 15, 2009 4:02 pm
Posts: 2
Hi,

I have a question about the hibernate locking mechanism.
I am using Hibernate 3.2.6, Atomikos XA transaction manager and Oracle 9g.

I have 3 threads of type A which performs lock operation 4 times per second:
Code:
session.lock(object, LockMode.UPGRADE_NO_WAIT);

This threads analyzes and modifies records in the database if the acquire the lock - otherwise they skip the execution.

I have another 5 threads of type B which performs operation in an asynchronous onMessage method (JMS message receiver)
Code:
session.lock(object, LockMode.UPGRADE); .

They wait for the lock - then performs update, and then commits the transaction.

Is it possible that threads of type A will cause a deadlocks in threads of type B?
I am asking whether the locks are granted in the order of session.lock method invocation?
Or maybe it is not deterministic.
I sometimes get transaction timeout (300 seconds) in threads of type B - so my assumption is that the lock ordering is not deterministic? Is that right?

Regards,
Tom


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.