Aaaarghhh! Your code looks definitely better than mine ...
As I said my code in GenericLock was wrong as well! It does not seem to be that easy... I will take over the corrected for loop stated below...
Where did you checkin your GenericLock? We should change ParentStore to use your lock (or even better: use a common lock manager).
Well, as it seems we do not need this locking in the ParentStore any more. Still it might be a good idea to use the read/write lock idea from TLock. GenericLock is needed for the file store and does well without priorities. But - as it seems - caching will need non-blocking locks to support isolation levels higher than READ COMMITTED. read/write locks would be nice for this...
Locks are in org.apache.slide.util.locking{.impl}... When you have a look at it, have in mind GenericLock is a multi level lock, i.e. there is at most *one* multi level lock per resource, but the lock itself can have more than one lock level and more than one owner. This is a bit excentric, but I saw it fit just right...
Oliver
Michael
On Tue, 2004-01-06 at 16:31, Oliver Zeigermann wrote:
Arghhh! After investigating both TLock and GenericLock for comparison it occurs to me *both* "acquire" methods are wrong as they use the wrong timeout in wait.
In TLock the timeout may be too *short* when the loop cicles more than once while in GenericLock the timeout may be too *long* as wait always waits the maximum timeout.
To solve this the for loop in awaitReader and awaitWriter in TLock might look like this:
for (remaining = timeout; remaining > 0; remaining = timeout - (System.currentTimeMillis() - started)) {
instead of the current loop
for (remaining = timeout; remaining > 0; remaining -= System.currentTimeMillis() - started) {
As I obviously failed once in this task that seemed so simple to me I may be wrong here again. Could someone smarter than me check this, please :)
Oliver
--------------------------------------------------------------------- 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]
