Repository: curator Updated Branches: refs/heads/CURATOR-217 fb274b1c8 -> 115611eca
Do watcher removal guaranteed in background Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/115611ec Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/115611ec Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/115611ec Branch: refs/heads/CURATOR-217 Commit: 115611eca927b6e8f91a0f27af46a888eac6b008 Parents: fb274b1 Author: randgalt <[email protected]> Authored: Tue May 19 17:56:35 2015 -0700 Committer: randgalt <[email protected]> Committed: Tue May 19 17:56:35 2015 -0700 ---------------------------------------------------------------------- .../curator/framework/imps/RemoveWatchesBuilderImpl.java | 7 ++++--- .../apache/curator/framework/imps/WatcherRemovalManager.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/115611ec/curator-framework/src/main/java/org/apache/curator/framework/imps/RemoveWatchesBuilderImpl.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/RemoveWatchesBuilderImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/RemoveWatchesBuilderImpl.java index 4b1b029..862a44b 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/RemoveWatchesBuilderImpl.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/RemoveWatchesBuilderImpl.java @@ -66,7 +66,8 @@ public class RemoveWatchesBuilderImpl implements RemoveWatchesBuilder, RemoveWat this.watcher = watcher; watcherType = WatcherType.Any; quietly = true; - this.backgrounding = new Backgrounding(); + this.backgrounding = new Backgrounding(true); + guaranteed = true; } @Override @@ -190,7 +191,7 @@ public class RemoveWatchesBuilderImpl implements RemoveWatchesBuilder, RemoveWat return null; } - private void pathInBackground(final String path) + void pathInBackground(final String path) { OperationAndData.ErrorCallback<String> errorCallback = null; @@ -211,7 +212,7 @@ public class RemoveWatchesBuilderImpl implements RemoveWatchesBuilder, RemoveWat errorCallback, backgrounding.getContext(), !local), null); } - void pathInForeground(final String path) throws Exception + private void pathInForeground(final String path) throws Exception { //For the local case we don't want to use the normal retry loop and we don't want to block until a connection is available. //We just execute the removeWatch, and if it fails, ZK will just remove local watches. http://git-wip-us.apache.org/repos/asf/curator/blob/115611ec/curator-framework/src/main/java/org/apache/curator/framework/imps/WatcherRemovalManager.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/WatcherRemovalManager.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/WatcherRemovalManager.java index fe5d4d6..72430ee 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/WatcherRemovalManager.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/WatcherRemovalManager.java @@ -69,7 +69,7 @@ public class WatcherRemovalManager log.debug("Removing watcher for path: " + entry.path); RemoveWatchesBuilderImpl builder = new RemoveWatchesBuilderImpl(client); builder.prepInternalRemoval(entry); - builder.pathInForeground(entry.path); + builder.pathInBackground(entry.path); } catch ( Exception e ) {
