Random back-off like this is unlikely to succeed (seems to me).  Better to
use the watch on the locks directory to make the wait as long as possible
AND as short as possible.

On Wed, Feb 24, 2010 at 8:53 AM, Patrick Hunt <ph...@apache.org> wrote:

> Anyone interested in locking an explicit resource attempts to create an
> ephemeral node in /locks with the same ### as they resource they want access
> to. If interested in just getting "any" resource then you would
> getchildren(/resources) and getchildren(/locks) and attempt to lock anything
> not in the intersection (avail). This could be done efficiently since
> resources won't change much, just cache the results of getchildren and set a
> watch at the same time. To lock a resource randomize "avail" and attempt to
> lock each in turn. If all avail fail to acq the lock, then have some random
> holdoff time, then re-getchildren(locks) and start over.

Ted Dunning, CTO

Reply via email to