commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mélanie Bats <>
Subject Re: [transaction.locking]Want to lock intervals
Date Wed, 06 Apr 2005 00:13:14 GMT

Oliver Zeigermann a écrit :

> All this would be in the lock manager and would not require changes to
> the lock classes.

In order to understand correctly how to implement the solution to my 
problem, I looked at the implementation of the GenericLock class. I have 
a few questions about it.

As far as I understand, a GenericLock is associated to a resourceId (the 
object _being_ locked, which in my problem will be an interval). When 
ones want to get a lock, either read or write, on this resourceId, the 
acquire() method is called. The ownerId is the object that _wants_ the 
lock (in my problem, will be a Thread). Am I right ?

I have the feeling that a GenericLock object has to be associated to an 
other object (the resourceId), for which it manages the lock. For 
example, if I define a MessageMailbox object, I could associate a 
GenericLock to it to handle the locking issues.

However, in my case, it is a bit different. The objects I am accessing 
are the nodes of an XML tree. However, I don't want to lock each node 
independently, but instead allocate dynamically intervals of nodes being 

Using the interval as the resourceId does not seem to be the right 
solution : the object being protected by the lock is not the interval 
itself, but rather the nodes covered by the interval. I'm not sure if 
it's all clear, but I think this small detail changes pretty much 

Any suggestion ?

Thanks for your help,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message