Hi, Selon Oliver Zeigermann <[EMAIL PROTECTED]>:
> When a lock on an interval is tried you first will have ot check for > all other intersecting ones without actually acquiring locks on them. > Only if this works you can acquire the lock on the desired interval. > Otherwise you will wait for them to be freed. I am trying to implement this solution. To do this, I need to get all the owners for each locks. How could I get them ? I get all the locks like this : Interval1D iIntervalTmp = new Interval1D(aInterval); Iterator iIter = mRWULockManager.getLocks().iterator(); for (ReadWriteLock iInterval = null; iIter.hasNext(); ) { iInterval = (ReadWriteLock) iIter.next(); if(iInterval.getLockLevel(iInterval.getOwner())!= 0) { System.out.println("Owner " + iInterval.getOwner() + (Interval1D) iInterval.getResourceId()); } } Here my problem is that I just get the first owner for each resource...I don't understand how to get all the owners. > Does this make sense? Sure and I am trying to implement it ;o) Thanks again for your help, Mel > On Apr 5, 2005 11:24 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > > > Selon Oliver Zeigermann <[EMAIL PROTECTED]>: > > > I suppose you pass the interval as the resourceId, right? > > > > Yes exactly. > > > > > The problem is that normally a single locks gets assigned to a > resourceid. I > > > do not think there is an easy solution if your intervals are not > > > discrete. > > > > They are not discrete. There is infinity number of values inside an > interval ;( > > > > > But if they are you could just enumerate all values as > > > resourceIds and try to lock check each and every of them. This would > > > of course require writing your own lock manager, but that shouldn't > > > be too hard. > > > > To find if intervals intersect I use the functions of the package > > xxl.core.util.Interval1D. If intervals intersect I must wait that thread > release > > locks on the interval. Using this I don't need to test all the values. > > > > Do you have ideas ? Is it possible to implement this just by modifying the > > ReadWriteLockManager ? > > > > Thanks, > > Mel > > > > > On Apr 5, 2005 10:46 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > wrote: > > > > Hi, > > > > > > > > I want to use the ReadWriteLockManager and ReadWriteLock on interval. > To > > > > facilitate the operation on interval I use the package > > > xxl.core.util.Interval1D. > > > > > > > > The LockManager works well if I try to get and release locks on same > > > interval. > > > > For example, a first thread T1 get a ReadLock on the interval I[1, 122] > and > > > then > > > > a second thread T2 try to obtain a WriteLock on I, T2 will wait until > T1 > > > release > > > > its lock on I. > > > > > > > > The LockManager does not work well in this case : a first thread T1 get > a > > > > ReadLock on the interval I1[1 , 5] and then a second thread T2 try to > > > obtain a > > > > WriteLock on I2[4 , 7], T2 will obtain is lock and we will have > > > incompatible > > > > locks on the intersection of I1 and I2 [4, 5]. > > > > > > > > The problem is that I1 and I2 are two different objects for the > > > LockManager. > > > > > > > > Is that possible to modify the ReadWriteLock and the > ReadWriteLockManager, > > > in > > > > order to determine when intervals intersect. It must verify the > > > compatibility of > > > > the lock or wait for the release when it is incompatible ? > > > > > > > > I expect I am clear, if not ask me for details :o) > > > > > > > > Thanks for your help, > > > > > > > > Mel > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]