Re: help on Lock.obtain(lockWaitTimeout)

2006-09-22 Thread Michael McCandless
Doron Cohen wrote: For obtain(timeout), to prevent waiting too long you could compute the maximum number of times that obtain() can be executed (assuming, as in current code, that obtain() executes in no time). Then break if either it was executed sufficiently many times or if time is up. I don't

Re: help on Lock.obtain(lockWaitTimeout)

2006-09-22 Thread Michael McCandless
Yonik Seeley wrote: On 9/21/06, Michael McCandless <[EMAIL PROTECTED]> wrote: Anyway, my first reaction was to change this to use System.currentTimeMillis() to measure elapsed time, but then I remembered is a dangerous approach because whenever the clock on the machine is updated (eg by a time-s

Re: help on Lock.obtain(lockWaitTimeout)

2006-09-21 Thread Doron Cohen
For obtain(timeout), to prevent waiting too long you could compute the maximum number of times that obtain() can be executed (assuming, as in current code, that obtain() executes in no time). Then break if either it was executed sufficiently many times or if time is up. I don't see how to prevent w

Re: help on Lock.obtain(lockWaitTimeout)

2006-09-21 Thread Yonik Seeley
On 9/21/06, Michael McCandless <[EMAIL PROTECTED]> wrote: Anyway, my first reaction was to change this to use System.currentTimeMillis() to measure elapsed time, but then I remembered is a dangerous approach because whenever the clock on the machine is updated (eg by a time-sync NTP client) it wo