(moved to zookeeper-dev) This API exposes internal implementation details which ties future versions of the client to supporting a particular set of semantics.
I would prefer deregisterWatcher, as a result. Henry On 19 March 2010 03:11, Dominic Williams <thedwilli...@googlemail.com>wrote: > Hi I can see some people might be assigning for example anonymous class > instances as watchers/handlers, and not keeping any references to them. > > To avoid breaking existing use cases, two options: > > 1/ Add a useWeakReferences parameter to new constructor (sets default > behaviour) > > 2/ Add alternative methods, which take useWeakWatcherRef boolean. > > Internally will be trivial to have both > > private final Map<String, Set<Watcher>> dataWatches = > new HashMap<String, Set<Watcher>>(); > > private final Map<String, WeakSet<Watcher>> dataWatchesWeak = > new HashMap<String, WeakSet<Watcher>>(); > > On 18 March 2010 22:47, Ted Dunning <ted.dunn...@gmail.com> wrote: > > > This kind of sounds strange to me. > > > > My typical idiom is to create a watcher but not retain any references to > it > > outside the client. It sounds to me like your change will cause my > > watchers > > to be collected and deactivated when GC happens. > > > > On Thu, Mar 18, 2010 at 3:32 AM, Dominic Williams < > > thedwilli...@googlemail.com> wrote: > > > > > > > > The current ZooKeeper client holds strong references to Watcher > objects. > > I > > > want to change the client so it only holds weak references. Feedback > > > please. > > > -- Henry Robinson Software Engineer Cloudera 415-994-6679