[
https://issues.apache.org/jira/browse/ZOOKEEPER-442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13850825#comment-13850825
]
Raul Gutierrez Segales commented on ZOOKEEPER-442:
--------------------------------------------------
One more nit in private boolean removeWatches:
{noformat}
+ if (watcher == null) {
+ Set<Watcher> pathWatchers = watches.remove(path);
+ if (pathWatchers != null) {
+ // found path watchers
+ removedWatchers.addAll(pathWatchers);
+ }
+ } else {
+ Set<Watcher> watchers = watches.get(path);
+ if (watcher != null) {
+ if (watchers.remove(watcher)) {
+ // found path watcher
+ removedWatchers.add(watcher);
+ }
+ }
+ }
{noformat}
the "if (watcher != null) {" check is superfluous since we are already in the
else block for watcher == null. It affects readability so I would drop it.
> need a way to remove watches that are no longer of interest
> -----------------------------------------------------------
>
> Key: ZOOKEEPER-442
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-442
> Project: ZooKeeper
> Issue Type: Sub-task
> Components: java client, server
> Reporter: Benjamin Reed
> Assignee: Rakesh R
> Priority: Critical
> Fix For: 3.5.0
>
> Attachments: Remove Watch API.pdf, ZOOKEEPER-442.patch,
> ZOOKEEPER-442.patch, ZOOKEEPER-442.patch, ZOOKEEPER-442.patch,
> ZOOKEEPER-442.patch, ZOOKEEPER-442.patch, ZOOKEEPER-442.patch,
> ZOOKEEPER-442.patch, ZOOKEEPER-442.patch, ZOOKEEPER-442.patch
>
>
> currently the only way a watch cleared is to trigger it. we need a way to
> enumerate the outstanding watch objects, find watch events the objects are
> watching for, and remove interests in an event.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)