Github user dragonsinth commented on a diff in the pull request:
https://github.com/apache/curator/pull/278#discussion_r219688410
--- Diff:
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
---
@@ -263,11 +281,20 @@ private void doRefreshData() throws Exception
{
if ( dataIsCompressed )
{
-
client.getData().decompressed().usingWatcher(this).inBackground(this).forPath(path);
+ if (createZkWatches) {
+
client.getData().decompressed().usingWatcher(this).inBackground(this).forPath(path);
+ } else {
+
client.getData().decompressed().inBackground(this).forPath(path);
+ }
--- End diff --
feel like this could all be a little cleaner with a maybeWatch() helper in
the class, e.g.
```
maybeWatch(client.getData().decompressed()).inBackground(this).forPath(path)
```
---