Repository: curator Updated Branches: refs/heads/CURATOR-161 a47c03671 -> 4f21e318f
CURATOR-161 - Updates after review. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4f21e318 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4f21e318 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4f21e318 Branch: refs/heads/CURATOR-161 Commit: 4f21e318f796cec4b32cafe14e0e2bf240817114 Parents: a47c036 Author: Cameron McKenzie <[email protected]> Authored: Wed May 20 11:57:10 2015 +1000 Committer: Cameron McKenzie <[email protected]> Committed: Wed May 20 11:57:10 2015 +1000 ---------------------------------------------------------------------- .../api/BackgroundPathableQuietly.java | 5 --- .../api/BackgroundPathableQuietlyable.java | 5 +++ .../curator/framework/api/DeleteBuilder.java | 2 +- .../curator/framework/api/Guaranteeable.java | 2 +- .../framework/api/GuaranteeableDeletable.java | 39 ++++++++++++++++++++ .../framework/api/GuaranteeableDelete.java | 39 -------------------- .../framework/api/RemoveWatchesLocal.java | 4 +- .../framework/api/RemoveWatchesType.java | 2 +- .../imps/FailedRemoveWatchManager.java | 2 +- .../framework/imps/NamespaceWatcherMap.java | 8 ---- .../imps/RemoveWatchesBuilderImpl.java | 4 +- 11 files changed, 52 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietly.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietly.java b/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietly.java deleted file mode 100644 index 1174067..0000000 --- a/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietly.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.apache.curator.framework.api; - -public interface BackgroundPathableQuietly<T> extends BackgroundPathable<T>, Quietly<BackgroundPathable<T>> -{ -} http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java b/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java new file mode 100644 index 0000000..8ed73fa --- /dev/null +++ b/curator-framework/src/main/java/org/apache/curator/framework/api/BackgroundPathableQuietlyable.java @@ -0,0 +1,5 @@ +package org.apache.curator.framework.api; + +public interface BackgroundPathableQuietlyable<T> extends BackgroundPathable<T>, Quietly<BackgroundPathable<T>> +{ +} http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/DeleteBuilder.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/DeleteBuilder.java b/curator-framework/src/main/java/org/apache/curator/framework/api/DeleteBuilder.java index 893e825..2da1843 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/api/DeleteBuilder.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/api/DeleteBuilder.java @@ -18,6 +18,6 @@ */ package org.apache.curator.framework.api; -public interface DeleteBuilder extends GuaranteeableDelete, ChildrenDeletable +public interface DeleteBuilder extends GuaranteeableDeletable, ChildrenDeletable { } http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/Guaranteeable.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/Guaranteeable.java b/curator-framework/src/main/java/org/apache/curator/framework/api/Guaranteeable.java index b43d6b0..bc033ac 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/api/Guaranteeable.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/api/Guaranteeable.java @@ -24,7 +24,7 @@ public interface Guaranteeable<T> * Solves edge cases where an operation may succeed on the server but connection failure occurs before a * response can be successfully returned to the client. * - * @see org.apache.curator.framework.api.GuaranteeableDelete + * @see org.apache.curator.framework.api.GuaranteeableDeletable * * @return this */ http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDeletable.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDeletable.java b/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDeletable.java new file mode 100644 index 0000000..7f8139c --- /dev/null +++ b/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDeletable.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.curator.framework.api; + +/** + * <p> + * Solves this edge case: deleting a node can fail due to connection issues. Further, + * if the node was ephemeral, the node will not get auto-deleted as the session is still valid. + * This can wreak havoc with lock implementations. + * </p> + * + * <p> + * When <code>guaranteed</code> is set, Curator will record failed node deletions and + * attempt to delete them in the background until successful. NOTE: you will still get an + * exception when the deletion fails. But, you can be assured that as long as the + * {@link org.apache.curator.framework.CuratorFramework} instance is open attempts will be made to delete the node. + * </p> + * + * @return this + */ +public interface GuaranteeableDeletable extends Guaranteeable<ChildrenDeletable>, BackgroundVersionable +{ +} http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDelete.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDelete.java b/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDelete.java deleted file mode 100644 index d04e7ea..0000000 --- a/curator-framework/src/main/java/org/apache/curator/framework/api/GuaranteeableDelete.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.curator.framework.api; - -/** - * <p> - * Solves this edge case: deleting a node can fail due to connection issues. Further, - * if the node was ephemeral, the node will not get auto-deleted as the session is still valid. - * This can wreak havoc with lock implementations. - * </p> - * - * <p> - * When <code>guaranteed</code> is set, Curator will record failed node deletions and - * attempt to delete them in the background until successful. NOTE: you will still get an - * exception when the deletion fails. But, you can be assured that as long as the - * {@link org.apache.curator.framework.CuratorFramework} instance is open attempts will be made to delete the node. - * </p> - * - * @return this - */ -public interface GuaranteeableDelete extends Guaranteeable<ChildrenDeletable>, BackgroundVersionable -{ -} http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesLocal.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesLocal.java b/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesLocal.java index e002857..1c94fb3 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesLocal.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesLocal.java @@ -4,7 +4,7 @@ package org.apache.curator.framework.api; * Builder to allow the specification of whether it is acceptable to remove client side watch information * in the case where ZK cannot be contacted. */ -public interface RemoveWatchesLocal extends BackgroundPathableQuietly<Void> +public interface RemoveWatchesLocal extends BackgroundPathableQuietlyable<Void> { /** @@ -12,6 +12,6 @@ public interface RemoveWatchesLocal extends BackgroundPathableQuietly<Void> * is not available. Note that the standard Curator retry loop will not be used in t * @return */ - public BackgroundPathableQuietly<Void> locally(); + public BackgroundPathableQuietlyable<Void> locally(); } http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesType.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesType.java b/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesType.java index 3112eac..21b5b50 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesType.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/api/RemoveWatchesType.java @@ -6,7 +6,7 @@ import org.apache.zookeeper.Watcher.WatcherType; * Builder to allow the specification of whether it is acceptable to remove client side watch information * in the case where ZK cannot be contacted. */ -public interface RemoveWatchesType extends RemoveWatchesLocal, Guaranteeable<BackgroundPathableQuietly<Void>> +public interface RemoveWatchesType extends RemoveWatchesLocal, Guaranteeable<BackgroundPathableQuietlyable<Void>> { /** http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/imps/FailedRemoveWatchManager.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/FailedRemoveWatchManager.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/FailedRemoveWatchManager.java index f954e2a..f635660 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/FailedRemoveWatchManager.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/FailedRemoveWatchManager.java @@ -32,7 +32,7 @@ class FailedRemoveWatchManager extends FailedOperationManager<FailedRemoveWatchM protected void executeGuaranteedOperationInBackground(FailedRemoveWatchDetails details) throws Exception { - if(details.watcher == null) + if(details.watcher == null) { client.watches().removeAll().guaranteed().inBackground().forPath(details.path); } http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceWatcherMap.java ---------------------------------------------------------------------- diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceWatcherMap.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceWatcherMap.java index f656ba1..e5aecb2 100644 --- a/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceWatcherMap.java +++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/NamespaceWatcherMap.java @@ -70,14 +70,6 @@ class NamespaceWatcherMap implements Closeable { return map.remove(key); } - - /** - * Remove all watchers for a given path - * @param path - */ - void removeAllForPath(String path) { - - } @VisibleForTesting boolean isEmpty() http://git-wip-us.apache.org/repos/asf/curator/blob/4f21e318/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 932706b..d734f79 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 @@ -7,7 +7,7 @@ import org.apache.curator.RetryLoop; import org.apache.curator.TimeTrace; import org.apache.curator.framework.api.BackgroundCallback; import org.apache.curator.framework.api.BackgroundPathable; -import org.apache.curator.framework.api.BackgroundPathableQuietly; +import org.apache.curator.framework.api.BackgroundPathableQuietlyable; import org.apache.curator.framework.api.CuratorEvent; import org.apache.curator.framework.api.CuratorEventType; import org.apache.curator.framework.api.CuratorWatcher; @@ -134,7 +134,7 @@ public class RemoveWatchesBuilderImpl implements RemoveWatchesBuilder, RemoveWat } @Override - public BackgroundPathableQuietly<Void> locally() + public BackgroundPathableQuietlyable<Void> locally() { local = true; return this;
