commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Zeigermann <oliver.zeigerm...@gmail.com>
Subject Re: [transaction.locking]Want to lock intervals
Date Wed, 06 Apr 2005 11:36:49 GMT
On Apr 6, 2005 2:13 AM, Mélanie Bats <melanie.bats@utbm.fr> wrote:
> Hello,
> 
> 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 ?

Yes.

> 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.

Yes.

> 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
> accessed.
> 
> 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
> everything.

I suppose what you want is some sort of hierarchical lock? Like if a
parent is locked the children are locked as well? Is that true?

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message