zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <jzimmer...@netflix.com>
Subject Priority Queue?
Date Fri, 15 Jul 2011 00:24:43 GMT
I'm trying to implement the Priority Queue recipe. There seems to be a big functionality hole
in ZooKeeper that makes the PriorityQueue less efficient than it could be.

When the watcher gets called for the path being watched, I do getChildren() and set a watch.
I then start processing the children. The recipe states that you should stop processing children
if the watcher fires (unlike a standard queue). This makes sense as another process might
have added an item that sorts before the current children list. This is where the problem
is. As my code processes children it must delete each child node as it process it to prevent
another Priority Queue in the system from processing the same child. The delete, though, will
fire the watcher I have set on getChildren(). Thus, every single item in the queue will cause
the code to abort and call getChildren() again.

Is there a way to tell ZooKeeper not to fire a watch to the same session that caused the event?
Or, is there a way to tell which session caused the event to fire? Without this, it's not
really possible to write a useful Priority Queue.

-JZ

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message