svn commit: r54840 - in /release/curator: 2.13.0/ 4.3.0/ 5.1.0/ 5.2.0/

2022-06-03 Thread randgalt
Author: randgalt
Date: Fri Jun  3 08:01:33 2022
New Revision: 54840

Log:
Removed old versions

Removed:
release/curator/2.13.0/
release/curator/4.3.0/
release/curator/5.1.0/
release/curator/5.2.0/



[curator] 01/01: `ChildrenCache` (used by Queues) didn't have a `ConnectionStateListener`. Thus, if a long network partition occurred the ZK instance would be recreated losing any set watcher and the

2021-12-15 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-623
in repository https://gitbox.apache.org/repos/asf/curator.git

commit ad5b1642a46720550356900f9b2c84af0e1de748
Author: randgalt 
AuthorDate: Sun Nov 14 13:00:51 2021 +

`ChildrenCache` (used by Queues) didn't have a `ConnectionStateListener`. 
Thus, if a long network partition occurred the ZK instance would be recreated 
losing any set watcher and the ChildrenCache would fail to continue watching 
changes. Adding a ConnectionStateListener fixes this.
---
 .../framework/recipes/queue/ChildrenCache.java | 34 +---
 .../recipes/queue/TestLongNetworkPartition.java| 98 ++
 2 files changed, 120 insertions(+), 12 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
index e5c7e8c..a28a1cc 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
@@ -25,6 +25,9 @@ import 
org.apache.curator.framework.WatcherRemoveCuratorFramework;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorWatcher;
+import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.curator.utils.PathUtils;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
 import java.io.Closeable;
@@ -33,7 +36,6 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
-import org.apache.curator.utils.PathUtils;
 
 class ChildrenCache implements Closeable
 {
@@ -49,7 +51,7 @@ class ChildrenCache implements Closeable
 {
 if ( !isClosed.get() )
 {
-sync(true);
+sync();
 }
 }
 };
@@ -66,6 +68,19 @@ class ChildrenCache implements Closeable
 }
 };
 
+private final ConnectionStateListener connectionStateListener = (__, 
newState) -> {
+if ((newState == ConnectionState.CONNECTED) || (newState == 
ConnectionState.RECONNECTED)) {
+try
+{
+sync();
+}
+catch ( Exception e )
+{
+throw new RuntimeException(e);
+}
+}
+};
+
 static class Data
 {
 final List  children;
@@ -86,13 +101,15 @@ class ChildrenCache implements Closeable
 
 void start() throws Exception
 {
-sync(true);
+
client.getConnectionStateListenable().addListener(connectionStateListener);
+sync();
 }
 
 @Override
 public void close() throws IOException
 {
 client.removeWatchers();
+
client.getConnectionStateListenable().removeListener(connectionStateListener);
 isClosed.set(true);
 notifyFromCallback();
 }
@@ -137,16 +154,9 @@ class ChildrenCache implements Closeable
 notifyAll();
 }
 
-private synchronized void sync(boolean watched) throws Exception
+private synchronized void sync() throws Exception
 {
-if ( watched )
-{
-
client.getChildren().usingWatcher(watcher).inBackground(callback).forPath(path);
-}
-else
-{
-client.getChildren().inBackground(callback).forPath(path);
-}
+
client.getChildren().usingWatcher(watcher).inBackground(callback).forPath(path);
 }
 
 private synchronized void setNewChildren(List newChildren)
diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
new file mode 100644
index 000..2e3c7a5
--- /dev/null
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
@@ -0,0 +1,98 @@
+/**
+ * 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" BA

[curator] branch CURATOR-623 updated (5c90640 -> ad5b164)

2021-12-15 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-623
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard 5c90640  `ChildrenCache` (used by Queues) didn't have a 
`ConnectionStateListener`. Thus, if a long network partition occurred the ZK 
instance would be recreated losing any set watcher and the ChildrenCache would 
fail to continue watching changes. Adding a ConnectionStateListener fixes this.
 new ad5b164  `ChildrenCache` (used by Queues) didn't have a 
`ConnectionStateListener`. Thus, if a long network partition occurred the ZK 
instance would be recreated losing any set watcher and the ChildrenCache would 
fail to continue watching changes. Adding a ConnectionStateListener fixes this.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5c90640)
\
 N -- N -- N   refs/heads/CURATOR-623 (ad5b164)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[curator] branch CURATOR-623 updated (f78e6d2 -> 5c90640)

2021-11-15 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-623
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard f78e6d2  `ChildrenCache` (used by Queues) didn't have a 
`ConnectionStateListener`. Thus, if a long network partition occurred the ZK 
instance would be recreated losing any set watcher and the ChildrenCache would 
fail to continue watching changes. Adding a ConnectionStateListener fixes this.
 new 5c90640  `ChildrenCache` (used by Queues) didn't have a 
`ConnectionStateListener`. Thus, if a long network partition occurred the ZK 
instance would be recreated losing any set watcher and the ChildrenCache would 
fail to continue watching changes. Adding a ConnectionStateListener fixes this.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f78e6d2)
\
 N -- N -- N   refs/heads/CURATOR-623 (5c90640)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/curator/framework/recipes/queue/ChildrenCache.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[curator] 01/01: `ChildrenCache` (used by Queues) didn't have a `ConnectionStateListener`. Thus, if a long network partition occurred the ZK instance would be recreated losing any set watcher and the

2021-11-15 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-623
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 5c906401e4575605ae4d83c99b8277d62fc9a885
Author: randgalt 
AuthorDate: Sun Nov 14 13:00:51 2021 +

`ChildrenCache` (used by Queues) didn't have a `ConnectionStateListener`. 
Thus, if a long network partition occurred the ZK instance would be recreated 
losing any set watcher and the ChildrenCache would fail to continue watching 
changes. Adding a ConnectionStateListener fixes this.
---
 .../framework/recipes/queue/ChildrenCache.java | 34 +---
 .../recipes/queue/TestLongNetworkPartition.java| 98 ++
 2 files changed, 120 insertions(+), 12 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
index e5c7e8c..a28a1cc 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
@@ -25,6 +25,9 @@ import 
org.apache.curator.framework.WatcherRemoveCuratorFramework;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorWatcher;
+import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.curator.utils.PathUtils;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
 import java.io.Closeable;
@@ -33,7 +36,6 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
-import org.apache.curator.utils.PathUtils;
 
 class ChildrenCache implements Closeable
 {
@@ -49,7 +51,7 @@ class ChildrenCache implements Closeable
 {
 if ( !isClosed.get() )
 {
-sync(true);
+sync();
 }
 }
 };
@@ -66,6 +68,19 @@ class ChildrenCache implements Closeable
 }
 };
 
+private final ConnectionStateListener connectionStateListener = (__, 
newState) -> {
+if ((newState == ConnectionState.CONNECTED) || (newState == 
ConnectionState.RECONNECTED)) {
+try
+{
+sync();
+}
+catch ( Exception e )
+{
+throw new RuntimeException(e);
+}
+}
+};
+
 static class Data
 {
 final List  children;
@@ -86,13 +101,15 @@ class ChildrenCache implements Closeable
 
 void start() throws Exception
 {
-sync(true);
+
client.getConnectionStateListenable().addListener(connectionStateListener);
+sync();
 }
 
 @Override
 public void close() throws IOException
 {
 client.removeWatchers();
+
client.getConnectionStateListenable().removeListener(connectionStateListener);
 isClosed.set(true);
 notifyFromCallback();
 }
@@ -137,16 +154,9 @@ class ChildrenCache implements Closeable
 notifyAll();
 }
 
-private synchronized void sync(boolean watched) throws Exception
+private synchronized void sync() throws Exception
 {
-if ( watched )
-{
-
client.getChildren().usingWatcher(watcher).inBackground(callback).forPath(path);
-}
-else
-{
-client.getChildren().inBackground(callback).forPath(path);
-}
+
client.getChildren().usingWatcher(watcher).inBackground(callback).forPath(path);
 }
 
 private synchronized void setNewChildren(List newChildren)
diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
new file mode 100644
index 000..2e3c7a5
--- /dev/null
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
@@ -0,0 +1,98 @@
+/**
+ * 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" BA

[curator] 01/01: `ChildrenCache` (used by Queues) didn't have a `ConnectionStateListener`. Thus, if a long network partition occurred the ZK instance would be recreated losing any set watcher and the

2021-11-14 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-623
in repository https://gitbox.apache.org/repos/asf/curator.git

commit f78e6d227058f2044b8b193506d5d864f6e50fa1
Author: randgalt 
AuthorDate: Sun Nov 14 13:00:51 2021 +

`ChildrenCache` (used by Queues) didn't have a `ConnectionStateListener`. 
Thus, if a long network partition occurred the ZK instance would be recreated 
losing any set watcher and the ChildrenCache would fail to continue watching 
changes. Adding a ConnectionStateListener fixes this.
---
 .../framework/recipes/queue/ChildrenCache.java | 34 +---
 .../recipes/queue/TestLongNetworkPartition.java| 98 ++
 2 files changed, 120 insertions(+), 12 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
index e5c7e8c..9e25e8d 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/ChildrenCache.java
@@ -25,6 +25,9 @@ import 
org.apache.curator.framework.WatcherRemoveCuratorFramework;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorWatcher;
+import org.apache.curator.framework.state.ConnectionState;
+import org.apache.curator.framework.state.ConnectionStateListener;
+import org.apache.curator.utils.PathUtils;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
 import java.io.Closeable;
@@ -33,7 +36,6 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
-import org.apache.curator.utils.PathUtils;
 
 class ChildrenCache implements Closeable
 {
@@ -49,7 +51,7 @@ class ChildrenCache implements Closeable
 {
 if ( !isClosed.get() )
 {
-sync(true);
+sync();
 }
 }
 };
@@ -66,6 +68,19 @@ class ChildrenCache implements Closeable
 }
 };
 
+private final ConnectionStateListener connectionStateListener = (__, 
newState) -> {
+if ((newState == ConnectionState.CONNECTED) || (newState == 
ConnectionState.RECONNECTED)) {
+try
+{
+sync();
+}
+catch ( Exception e )
+{
+throw new RuntimeException(e);
+}
+}
+};
+
 static class Data
 {
 final List  children;
@@ -86,12 +101,14 @@ class ChildrenCache implements Closeable
 
 void start() throws Exception
 {
-sync(true);
+
client.getConnectionStateListenable().addListener(connectionStateListener);
+sync();
 }
 
 @Override
 public void close() throws IOException
 {
+
client.getConnectionStateListenable().removeListener(connectionStateListener);
 client.removeWatchers();
 isClosed.set(true);
 notifyFromCallback();
@@ -137,16 +154,9 @@ class ChildrenCache implements Closeable
 notifyAll();
 }
 
-private synchronized void sync(boolean watched) throws Exception
+private synchronized void sync() throws Exception
 {
-if ( watched )
-{
-
client.getChildren().usingWatcher(watcher).inBackground(callback).forPath(path);
-}
-else
-{
-client.getChildren().inBackground(callback).forPath(path);
-}
+
client.getChildren().usingWatcher(watcher).inBackground(callback).forPath(path);
 }
 
 private synchronized void setNewChildren(List newChildren)
diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
new file mode 100644
index 000..2e3c7a5
--- /dev/null
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestLongNetworkPartition.java
@@ -0,0 +1,98 @@
+/**
+ * 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 W

[curator] branch CURATOR-623 created (now f78e6d2)

2021-11-14 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-623
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at f78e6d2  `ChildrenCache` (used by Queues) didn't have a 
`ConnectionStateListener`. Thus, if a long network partition occurred the ZK 
instance would be recreated losing any set watcher and the ChildrenCache would 
fail to continue watching changes. Adding a ConnectionStateListener fixes this.

This branch includes the following new commits:

 new f78e6d2  `ChildrenCache` (used by Queues) didn't have a 
`ConnectionStateListener`. Thus, if a long network partition occurred the ZK 
instance would be recreated losing any set watcher and the ChildrenCache would 
fail to continue watching changes. Adding a ConnectionStateListener fixes this.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[curator] 02/02: This commit reverts changes that altered the ZPath parse method based on incorrect assumptions about what a "resolved" ZPath actually is.

2021-08-18 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 137159bb919cb7915eb1ddb3a3dfe369bd2253b9
Author: Ryan Ruel 
AuthorDate: Wed Aug 18 10:57:42 2021 -0400

This commit reverts changes that altered the ZPath parse method based on  
incorrect assumptions about what a "resolved" ZPath actually is.

I've added a few notes to the JavaDoc and unit tests to hopefully clear up 
confusion in this area in the future.
---
 .../org/apache/curator/x/async/modeled/ZPath.java| 20 +---
 .../curator/x/async/modeled/details/ZPathImpl.java   |  7 ++-
 .../apache/curator/x/async/modeled/TestZPath.java| 16 ++--
 3 files changed, 21 insertions(+), 22 deletions(-)

diff --git 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java
index e15a6bc..0958975 100644
--- 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java
+++ 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java
@@ -31,9 +31,6 @@ import static org.apache.curator.utils.ZKPaths.PATH_SEPARATOR;
  */
 public interface ZPath extends Resolvable
 {
-String PARAMETER_OPENING_DELIMITER = "{";
-String PARAMETER_CLOSING_DELIMITER = "}";
-
 /**
  * The root path: "/"
  */
@@ -55,11 +52,14 @@ public interface ZPath extends Resolvable
  */
 static String parameter(String name)
 {
-return PATH_SEPARATOR + PARAMETER_OPENING_DELIMITER + name + 
PARAMETER_CLOSING_DELIMITER;
+return PATH_SEPARATOR + "{" + name + "}";
 }
 
 /**
- * Take a string path and return a ZPath
+ * Take a string path and return a ZPath.
+ * 
+ * Note: This method always produces a fully resolved path despite the 
presence of any parameter-like elements (i.e, {@code {one}}).
+ * For substituting parameter elements and for proper parameter resolution 
status checks, use {@code parseWithIds()} instead.
  *
  * @param fullPath the path to parse
  * @return ZPath
@@ -82,7 +82,7 @@ public interface ZPath extends Resolvable
  */
 static ZPath parseWithIds(String fullPath)
 {
-return ZPathImpl.parse(fullPath, s -> isId(s) ? (PATH_SEPARATOR + s) : 
s); // TODO
+return ZPathImpl.parse(fullPath, s -> isId(s) ? (PATH_SEPARATOR + s) : 
s);
 }
 
 /**
@@ -244,7 +244,13 @@ public interface ZPath extends Resolvable
 boolean isRoot();
 
 /**
- * Return true if this path is fully resolved (i.e. has no unresolved 
parameters)
+ * Return true if this path is fully resolved (i.e. has no unresolved 
parameters).
+ * 
+ * Note: ZPath's returned by the {@code parse()} method are always 
considered fully resolved, despite if there are
+ * remaining elements in the path which appear to be parameters (but are 
not, i.e. {@code {one}}).
+ * 
+ * When working with parameters, use the {@code parseWithIds()} method, 
which returns a ZPath with a
+ * resolved state based on the presence of unresolved parameter elements 
in the ZPath.
  *
  * @return true/false
  */
diff --git 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
index b04c4b4..fff742e 100644
--- 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
+++ 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
@@ -210,9 +210,7 @@ public class ZPathImpl implements ZPath
 .map(name -> {
 if ( isParameter(name) && iterator.hasNext() )
 {
-// Eliminate any leading path separator from substituted 
parameters, as ZPathImpl() will
-// add in all required path separators as part of it's 
build operation.
-return 
NodeName.nameFrom(iterator.next()).replaceAll(String.format("^%s+", 
PATH_SEPARATOR), "");
+return NodeName.nameFrom(iterator.next());
 }
 return name;
 })
@@ -228,8 +226,7 @@ public class ZPathImpl implements ZPath
 
 private static boolean isParameter(String name)
 {
-return name.matches(String.format(".*\\%s.*\\%s", 
PARAMETER_OPENING_DELIMITER,
-PARAMETER_CLOSING_DELIMITER));
+return (name.length() > 1) && name.startsWith(PATH_SEPARATOR);
 }
 
 private ZPathImpl(List nodes, String child)
diff --git 
a/curator-x-async/src/test/java/org/apache/curator/x/async/modeled/TestZPath.java
 
b/curator-x-async/src/test/java/org/apache/curator/x/async/modele

[curator] 01/02: Modified ZPathImpl's "isParameter()" method to properly check for parameters strings (values inside of a pair parameter delimiters). This corrects issues with checking for path resolu

2021-08-18 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 0128b96f4bc1766dc1fc37c70b0d98e72e50405f
Author: Ryan Ruel 
AuthorDate: Wed Aug 4 15:20:18 2021 -0400

Modified ZPathImpl's "isParameter()" method to properly check for 
parameters strings (values inside of a pair parameter delimiters).  This 
corrects issues with checking for path resolution status in certain cases.

Modified ZPathImpl's "resolved()" method to allow for substituted 
parameters to have leading path separators ("/"). This is useful in the case 
where a parameter is used for the first node element in the path, eliminating 
the need for the user to worry about the leading "/".

Added an additional unit test case for the leading "/" changes, and fixed 
bugs in the basic test cases that were accepting the wrong resolved state of 
tested ZPaths.

All unit tests for curator pass.
---
 .../main/java/org/apache/curator/x/async/modeled/ZPath.java |  7 +--
 .../apache/curator/x/async/modeled/details/ZPathImpl.java   |  7 +--
 .../java/org/apache/curator/x/async/modeled/TestZPath.java  | 13 ++---
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java
index 70ac536..e15a6bc 100644
--- 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java
+++ 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/ZPath.java
@@ -31,6 +31,9 @@ import static org.apache.curator.utils.ZKPaths.PATH_SEPARATOR;
  */
 public interface ZPath extends Resolvable
 {
+String PARAMETER_OPENING_DELIMITER = "{";
+String PARAMETER_CLOSING_DELIMITER = "}";
+
 /**
  * The root path: "/"
  */
@@ -52,7 +55,7 @@ public interface ZPath extends Resolvable
  */
 static String parameter(String name)
 {
-return PATH_SEPARATOR + "{" + name + "}";
+return PATH_SEPARATOR + PARAMETER_OPENING_DELIMITER + name + 
PARAMETER_CLOSING_DELIMITER;
 }
 
 /**
@@ -241,7 +244,7 @@ public interface ZPath extends Resolvable
 boolean isRoot();
 
 /**
- * Return true if this path is fully resolved (i.e. has no unresoled 
parameters)
+ * Return true if this path is fully resolved (i.e. has no unresolved 
parameters)
  *
  * @return true/false
  */
diff --git 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
index fff742e..b04c4b4 100644
--- 
a/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
+++ 
b/curator-x-async/src/main/java/org/apache/curator/x/async/modeled/details/ZPathImpl.java
@@ -210,7 +210,9 @@ public class ZPathImpl implements ZPath
 .map(name -> {
 if ( isParameter(name) && iterator.hasNext() )
 {
-return NodeName.nameFrom(iterator.next());
+// Eliminate any leading path separator from substituted 
parameters, as ZPathImpl() will
+// add in all required path separators as part of it's 
build operation.
+return 
NodeName.nameFrom(iterator.next()).replaceAll(String.format("^%s+", 
PATH_SEPARATOR), "");
 }
 return name;
 })
@@ -226,7 +228,8 @@ public class ZPathImpl implements ZPath
 
 private static boolean isParameter(String name)
 {
-return (name.length() > 1) && name.startsWith(PATH_SEPARATOR);
+return name.matches(String.format(".*\\%s.*\\%s", 
PARAMETER_OPENING_DELIMITER,
+PARAMETER_CLOSING_DELIMITER));
 }
 
 private ZPathImpl(List nodes, String child)
diff --git 
a/curator-x-async/src/test/java/org/apache/curator/x/async/modeled/TestZPath.java
 
b/curator-x-async/src/test/java/org/apache/curator/x/async/modeled/TestZPath.java
index e35354c..c1d4697 100644
--- 
a/curator-x-async/src/test/java/org/apache/curator/x/async/modeled/TestZPath.java
+++ 
b/curator-x-async/src/test/java/org/apache/curator/x/async/modeled/TestZPath.java
@@ -57,11 +57,11 @@ public class TestZPath
 assertFalse(path.startsWith(ZPath.root.child("two")));
 
 ZPath checkIdLike = ZPath.parse("/one/{two}/three");
-assertTrue(checkIdLike.isResolved());
+assertFalse(checkIdLike.isResolved());
 checkIdLike = ZPath.parse("/one/" + ZPath.parameter() + "/three");
-assertTrue(checkIdLike.isResolved());
+assertFalse(checkIdLike.isResolved());
 checkIdLike = 

[curator] branch master updated (9aafdec -> 137159b)

2021-08-18 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git.


from 9aafdec  CURATOR-610: Refactor CountCuratorWatcher in 
TestWatcherIdentity.java …
 new 0128b96  Modified ZPathImpl's "isParameter()" method to properly check 
for parameters strings (values inside of a pair parameter delimiters).  This 
corrects issues with checking for path resolution status in certain cases.
 new 137159b  This commit reverts changes that altered the ZPath parse 
method based on  incorrect assumptions about what a "resolved" ZPath actually 
is.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/curator/x/async/modeled/ZPath.java| 15 ---
 .../org/apache/curator/x/async/modeled/TestZPath.java |  9 ++---
 2 files changed, 18 insertions(+), 6 deletions(-)


[curator] branch master updated: Make Enrico Olivelli PMC chair

2020-11-18 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 95f147f  Make Enrico Olivelli PMC chair
95f147f is described below

commit 95f147f8a864375744a566af3d550659f512728b
Author: randgalt 
AuthorDate: Wed Nov 18 19:47:33 2020 -0500

Make Enrico Olivelli PMC chair
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index b3949fe..115570f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -178,7 +178,7 @@
 -5
 
 Committer
-PMC Chair
+PMC Member
 
 https://people.apache.org/~randgalt
 
@@ -324,7 +324,7 @@
 +1
 
 Committer
-PMC Member
+PMC Chair
 
 https://people.apache.org/~eolivelli
 



svn commit: r1880012 - in /curator/site/trunk: curator-client/ curator-client/apidocs/ curator-client/apidocs/org/ curator-client/apidocs/org/apache/ curator-client/apidocs/org/apache/curator/ curator

2020-07-17 Thread randgalt
Author: randgalt
Date: Sat Jul 18 02:06:57 2020
New Revision: 1880012

URL: http://svn.apache.org/viewvc?rev=1880012=rev
Log:
Fixed broken website for 5.1.1-SNAPSHOT - try 2


[This commit notification would consist of 355 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]


svn commit: r1880011 - in /curator/site/trunk: ./ apidocs/ apidocs/async/ apidocs/async/class-use/ apidocs/cache/ apidocs/cache/class-use/ apidocs/discovery/ apidocs/discovery/class-use/ apidocs/frame

2020-07-17 Thread randgalt
Author: randgalt
Date: Sat Jul 18 01:58:51 2020
New Revision: 1880011

URL: http://svn.apache.org/viewvc?rev=1880011=rev
Log:
Fixed broken website for 5.1.1-SNAPSHOT


[This commit notification would consist of 425 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]


svn commit: r1879729 - in /curator/site/trunk/staging: ./ apidocs/ apidocs/async/ apidocs/async/class-use/ apidocs/cache/ apidocs/cache/class-use/ apidocs/discovery/ apidocs/discovery/class-use/ apido

2020-07-09 Thread randgalt
Author: randgalt
Date: Thu Jul  9 22:27:57 2020
New Revision: 1879729

URL: http://svn.apache.org/viewvc?rev=1879729=rev
Log:
Staged website for CURATOR-577


[This commit notification would consist of 646 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]


[curator] 01/01: CURATOR-577 - Add a dedicated downloads page to the website

2020-07-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-577-add-downloads-page-to-website
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 3031858538370811c1a43dbf1bd1992ec999e179
Author: randgalt 
AuthorDate: Thu Jul 9 17:11:47 2020 -0500

CURATOR-577 - Add a dedicated downloads page to the website

Add a dedicated downloads page to the website. Note: this page depends
on the new property "currentStableVersion"
---
 pom.xml|  3 +++
 src/site/confluence/index.confluence   |  4 
 src/site/confluence/releases.confluence.vm | 22 ++
 src/site/site.xml  |  3 +--
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index cae1880..98104d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,8 @@
 
 
 
+5.1.0
+
 UTF-8
 UTF-8
 
UTF-8
@@ -800,6 +802,7 @@
 src/etc/header.txt
 
 **/*.confluence
+**/*.confluence.vm
 **/help.txt
 **/*.rdf
 **/.gitignore
diff --git a/src/site/confluence/index.confluence 
b/src/site/confluence/index.confluence
index 8ea1c0e..fcaaed6 100644
--- a/src/site/confluence/index.confluence
+++ b/src/site/confluence/index.confluence
@@ -8,6 +8,10 @@ Apache Curator is a Java/JVM client library for [[Apache 
ZooKeeper|https://zooke
 
 !images/ph-quote.png!
 
+h2. Download
+
+[[Download Apache Curator|releases.html]] from the release page.
+
 h2. Important Compatibility Updates
 
 Note: version 5.0 of Curator has a few breaking changes. Please read the 
details here:
diff --git a/src/site/confluence/releases.confluence.vm 
b/src/site/confluence/releases.confluence.vm
new file mode 100644
index 000..ee3213f
--- /dev/null
+++ b/src/site/confluence/releases.confluence.vm
@@ -0,0 +1,22 @@
+h1. Apache Curator Releases
+
+h2. Download
+The current release can be [[downloaded using these links|#Current_Release]].
+
+Older releases are available from the 
[[archive|https://archive.apache.org/dist/curator/]].
+
+You can verify the integrity of a downloaded release using the PGP signatures 
and hashes hosted at the main Apache distribution site.
+For additional information, refer to the Apache documentation for [[verifying 
the integrity of Apache project 
releases|https://www.apache.org/info/verification.html]].
+The binary artifacts for Curator are available from [[Maven 
Central|http://search.maven.org/#search%7Cga%7C1%7Corg.apache.curator]] and its 
mirrors.
+
+h2. Current Release
+
+* Current Release: 
[[apache\-curator\-${currentStableVersion}\-source\-release.zip|https://downloads.apache.org/curator/${currentStableVersion}/apache-curator-${currentStableVersion}-source-release.zip]]
+* PGP: 
[[apache\-curator\-${currentStableVersion}\-source\-release.zip.asc|https://downloads.apache.org/curator/${currentStableVersion}/apache-curator-${currentStableVersion}-source-release.zip.asc]]
+* SHA\-512: 
[[apache\-curator\-${currentStableVersion}\-source\-release.zip.sha512|https://downloads.apache.org/curator/${currentStableVersion}/apache-curator-${currentStableVersion}-source-release.zip.sha512]]
+* Keys: [[KEYS|https://downloads.apache.org/curator/KEYS]]
+
+h2. All Releases / History
+
+See [[Curator's Release 
Wiki|https://cwiki.apache.org/confluence/display/CURATOR/Releases]] for a 
detailed historical
+list of releases.
diff --git a/src/site/site.xml b/src/site/site.xml
index 7d9224f..7975c55 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -71,7 +71,7 @@
 
 
 
-https://cwiki.apache.org/confluence/display/CURATOR/Releases"/>
+
 
 
 
@@ -97,7 +97,6 @@
 
 
 https://cwiki.apache.org/confluence/display/CURATOR"/>
-https://cwiki.apache.org/confluence/display/CURATOR/Releases"/>
 
 
 



[curator] branch CURATOR-577-add-downloads-page-to-website created (now 3031858)

2020-07-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-577-add-downloads-page-to-website
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at 3031858  CURATOR-577 - Add a dedicated downloads page to the website

This branch includes the following new commits:

 new 3031858  CURATOR-577 - Add a dedicated downloads page to the website

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] branch master updated: Update README.md

2020-06-25 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new bca07dd  Update README.md
bca07dd is described below

commit bca07ddf8af6091284ba5539def779cc143d4fe7
Author: Jordan Zimmerman 
AuthorDate: Thu Jun 25 10:27:22 2020 -0500

Update README.md

Added Twitter follow badge
---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 591150a..c966a14 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@
 [![Maven 
Central](https://img.shields.io/maven-central/v/org.apache.curator/apache-curator.svg?logo=Apache+Maven=blue)](http://search.maven.org/#search%7Cga%7C1%7Capache-curator)
 [![Curator 
Website](https://img.shields.io/badge/curator-Curator_Website-red?logo=Apache=red)](https://curator.apache.org)
 [![Stack 
Overflow](https://img.shields.io/badge/stackoverflow-Curator_Help-orange?logo=Stack+Overflow=orange)](https://stackoverflow.com/questions/tagged/apache-curator)
+[![Twitter](https://img.shields.io/badge/Follow-@Curator-55acee?logo=Twitter=55acee)](https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fgithub.com%2Fapache%2Fcurator_src=twsrc%5Etfw=follow_link_name=ApacheCurator_p=followbutton)
 
 
 ## What's is Apache Curator?



[curator] 01/01: CURATOR-575 - TestingServer shutdown can cause an NPE due to FileTxnSnapLog being closed in a different thread

2020-06-24 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-575-fix-testing-server-npe
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 103911752468a133f44020d8f8dd355f8d0ff602
Author: randgalt 
AuthorDate: Wed Jun 24 20:15:40 2020 -0500

CURATOR-575 - TestingServer shutdown can cause an NPE due to FileTxnSnapLog 
being closed in a different thread
---
 .../apache/curator/test/TestingZooKeeperMain.java  | 24 --
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git 
a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java 
b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
index d53fb08..cdf59d0 100644
--- 
a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
+++ 
b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
@@ -226,13 +226,12 @@ public class TestingZooKeeperMain implements 
ZooKeeperMainFace
 private void internalRunFromConfig(ServerConfig config) throws IOException
 {
 log.info("Starting server");
-FileTxnSnapLog txnLog = null;
 try {
 // Note that this thread isn't going to be doing anything else,
 // so rather than spawning another thread, we will just call
 // run() in this thread.
 // create a file logger url from the command line args
-txnLog = new FileTxnSnapLog(config.getDataLogDir(), 
config.getDataDir());
+FileTxnSnapLog txnLog = new FileTxnSnapLog(config.getDataLogDir(), 
config.getDataDir());
 zkServer = new TestZooKeeperServer(txnLog, config);
 
 try
@@ -261,22 +260,35 @@ public class TestingZooKeeperMain implements 
ZooKeeperMainFace
 // warn, but generally this is ok
 Thread.currentThread().interrupt();
 log.warn("Server interrupted", e);
-} finally {
-if (txnLog != null) {
-txnLog.close();
-}
 }
 }
 
 public static class TestZooKeeperServer extends ZooKeeperServer
 {
+private final FileTxnSnapLog txnLog;
+
 public TestZooKeeperServer(FileTxnSnapLog txnLog, ServerConfig config)
 {
+this.txnLog = txnLog;
 this.setTxnLogFactory(txnLog);
 this.setMinSessionTimeout(config.getMinSessionTimeout());
 this.setMaxSessionTimeout(config.getMaxSessionTimeout());
 }
 
+@Override
+public synchronized void shutdown(boolean fullyShutDown)
+{
+super.shutdown(fullyShutDown);
+try
+{
+txnLog.close();
+}
+catch ( IOException e )
+{
+// ignore
+}
+}
+
 private final AtomicBoolean isRunning = new AtomicBoolean(false);
 
 public RequestProcessor getFirstProcessor()



[curator] branch CURATOR-575-fix-testing-server-npe updated (c439f38 -> 1039117)

2020-06-24 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-575-fix-testing-server-npe
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard c439f38  CURATOR-575 - TestingServer shutdown can cause an NPW due to 
FileTxnSnapLog being closed in a different thread
 new 1039117  CURATOR-575 - TestingServer shutdown can cause an NPE due to 
FileTxnSnapLog being closed in a different thread

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (c439f38)
\
 N -- N -- N   refs/heads/CURATOR-575-fix-testing-server-npe 
(1039117)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:



[curator] branch CURATOR-575-fix-testing-server-npe created (now c439f38)

2020-06-24 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-575-fix-testing-server-npe
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at c439f38  CURATOR-575 - TestingServer shutdown can cause an NPW due to 
FileTxnSnapLog being closed in a different thread

This branch includes the following new commits:

 new c439f38  CURATOR-575 - TestingServer shutdown can cause an NPW due to 
FileTxnSnapLog being closed in a different thread

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] 01/01: CURATOR-575 - TestingServer shutdown can cause an NPW due to FileTxnSnapLog being closed in a different thread

2020-06-24 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-575-fix-testing-server-npe
in repository https://gitbox.apache.org/repos/asf/curator.git

commit c439f38f3e5e1d9a277d8b124800f2bd0053acc0
Author: randgalt 
AuthorDate: Wed Jun 24 20:15:40 2020 -0500

CURATOR-575 - TestingServer shutdown can cause an NPW due to FileTxnSnapLog 
being closed in a different thread
---
 .../apache/curator/test/TestingZooKeeperMain.java  | 24 --
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git 
a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java 
b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
index d53fb08..cdf59d0 100644
--- 
a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
+++ 
b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
@@ -226,13 +226,12 @@ public class TestingZooKeeperMain implements 
ZooKeeperMainFace
 private void internalRunFromConfig(ServerConfig config) throws IOException
 {
 log.info("Starting server");
-FileTxnSnapLog txnLog = null;
 try {
 // Note that this thread isn't going to be doing anything else,
 // so rather than spawning another thread, we will just call
 // run() in this thread.
 // create a file logger url from the command line args
-txnLog = new FileTxnSnapLog(config.getDataLogDir(), 
config.getDataDir());
+FileTxnSnapLog txnLog = new FileTxnSnapLog(config.getDataLogDir(), 
config.getDataDir());
 zkServer = new TestZooKeeperServer(txnLog, config);
 
 try
@@ -261,22 +260,35 @@ public class TestingZooKeeperMain implements 
ZooKeeperMainFace
 // warn, but generally this is ok
 Thread.currentThread().interrupt();
 log.warn("Server interrupted", e);
-} finally {
-if (txnLog != null) {
-txnLog.close();
-}
 }
 }
 
 public static class TestZooKeeperServer extends ZooKeeperServer
 {
+private final FileTxnSnapLog txnLog;
+
 public TestZooKeeperServer(FileTxnSnapLog txnLog, ServerConfig config)
 {
+this.txnLog = txnLog;
 this.setTxnLogFactory(txnLog);
 this.setMinSessionTimeout(config.getMinSessionTimeout());
 this.setMaxSessionTimeout(config.getMaxSessionTimeout());
 }
 
+@Override
+public synchronized void shutdown(boolean fullyShutDown)
+{
+super.shutdown(fullyShutDown);
+try
+{
+txnLog.close();
+}
+catch ( IOException e )
+{
+// ignore
+}
+}
+
 private final AtomicBoolean isRunning = new AtomicBoolean(false);
 
 public RequestProcessor getFirstProcessor()



svn commit: r1878253 - in /curator/site/trunk: ./ apidocs/ apidocs/async/ apidocs/async/class-use/ apidocs/cache/ apidocs/cache/class-use/ apidocs/discovery/ apidocs/discovery/class-use/ apidocs/frame

2020-05-28 Thread randgalt
Author: randgalt
Date: Thu May 28 23:33:31 2020
New Revision: 1878253

URL: http://svn.apache.org/viewvc?rev=1878253=rev
Log:
Update for Curator version 5.0.0


[This commit notification would consist of 186 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]


[curator] branch master updated: Fixed typo

2020-05-20 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 751724b  Fixed typo
751724b is described below

commit 751724b6a831e4ffd14f6e8cc76c9f1954d2c629
Author: Jordan Zimmerman 
AuthorDate: Wed May 20 11:31:01 2020 -0500

Fixed typo
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 24ff845..591150a 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Apache Curator is a Java/JVM client library for [Apache 
ZooKeeper](https://zooke
 
 Apache Curator includes a high-level API framework and utilities to make using 
Apache ZooKeeper much easier and more reliable. It also includes recipes for 
common use cases and extensions such as service discovery and a Java 8 
asynchronous DSL.
 
-For more details, please visit the project website: 
+For more details:
 
 - Apache Curator Website: http://curator.apache.org/
 - Binaries on Maven Central: 
[http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Capache-curator)



[curator] branch master updated: More/better links in the Read Me

2020-05-20 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 69d458f  More/better links in the Read Me
69d458f is described below

commit 69d458f8f365511541454c6f5c79e86816f7261a
Author: Jordan Zimmerman 
AuthorDate: Wed May 20 11:30:30 2020 -0500

More/better links in the Read Me
---
 README.md | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index 6e811f2..24ff845 100644
--- a/README.md
+++ b/README.md
@@ -8,10 +8,14 @@
 
 ## What's is Apache Curator?
 
-Apache Curator is a Java/JVM client library for Apache ZooKeeper[1], a 
distributed coordination service.
+Apache Curator is a Java/JVM client library for [Apache 
ZooKeeper](https://zookeeper.apache.org/), a distributed coordination service.
 
 Apache Curator includes a high-level API framework and utilities to make using 
Apache ZooKeeper much easier and more reliable. It also includes recipes for 
common use cases and extensions such as service discovery and a Java 8 
asynchronous DSL.
-For more details, please visit the project website: http://curator.apache.org/
 
-[1] Apache ZooKeeper https://zookeeper.apache.org/
+For more details, please visit the project website: 
 
+- Apache Curator Website: http://curator.apache.org/
+- Binaries on Maven Central: 
[http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Capache-curator)
+- Best source of help for Curator: [Stack Overflow's Curator 
tag](https://stackoverflow.com/questions/tagged/apache-curator)
+- Apache ZooKeeper Website: https://zookeeper.apache.org
+- Curator's Wiki: http://cwiki.apache.org/confluence/display/CURATOR



[curator] branch master updated: Fixed the website badge

2020-05-20 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 3f84f0e  Fixed the website badge
3f84f0e is described below

commit 3f84f0e27a2506b133ca47e46b7bd39a08822738
Author: Jordan Zimmerman 
AuthorDate: Wed May 20 11:26:11 2020 -0500

Fixed the website badge
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 39855d5..6e811f2 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 [![Build 
Status](https://travis-ci.org/apache/curator.svg?branch=master)](https://travis-ci.org/apache/curator)
 [![Maven 
Central](https://img.shields.io/maven-central/v/org.apache.curator/apache-curator.svg?logo=Apache+Maven=blue)](http://search.maven.org/#search%7Cga%7C1%7Capache-curator)
-[![Curator 
Website](https://img.shields.io/badge/curator-website-red?logo=Apache=red)](https://curator.apache.org)
+[![Curator 
Website](https://img.shields.io/badge/curator-Curator_Website-red?logo=Apache=red)](https://curator.apache.org)
 [![Stack 
Overflow](https://img.shields.io/badge/stackoverflow-Curator_Help-orange?logo=Stack+Overflow=orange)](https://stackoverflow.com/questions/tagged/apache-curator)
 
 



svn commit: r1877906 - in /curator/site/trunk/staging: ./ apidocs/ apidocs/async/ apidocs/async/class-use/ apidocs/cache/ apidocs/cache/class-use/ apidocs/discovery/ apidocs/discovery/class-use/ apido

2020-05-18 Thread randgalt
Author: randgalt
Date: Tue May 19 05:40:29 2020
New Revision: 1877906

URL: http://svn.apache.org/viewvc?rev=1877906=rev
Log:
staged the 5.0 website


[This commit notification would consist of 643 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]


[curator] branch master updated: CURATOR-569

2020-05-15 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new f73b8fb  CURATOR-569
f73b8fb is described below

commit f73b8fbb0429b7df934ee17f30f2846e7391deee
Author: chevaris 
AuthorDate: Sun May 10 18:41:05 2020 +0200

CURATOR-569

- New methods to handle protected ZNode names
---
 .../curator/framework/api/CreateBuilderMain.java   |  15 +-
 .../curator/framework/imps/CreateBuilderImpl.java  |  18 +--
 .../curator/framework/imps/ProtectedMode.java  |   8 +-
 .../curator/framework/imps/ProtectedUtils.java | 165 +
 .../apache/curator/framework/imps/TestCreate.java  |  94 +---
 .../curator/framework/imps/TestFrameworkEdges.java |   4 +-
 .../curator/framework/imps/TestFramework.java  |  12 +-
 7 files changed, 263 insertions(+), 53 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/api/CreateBuilderMain.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/api/CreateBuilderMain.java
index 3d076b2..a90ad3e 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/api/CreateBuilderMain.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/api/CreateBuilderMain.java
@@ -18,6 +18,9 @@
  */
 package org.apache.curator.framework.api;
 
+import java.util.UUID;
+
+import org.apache.curator.framework.imps.ProtectedUtils;
 import org.apache.zookeeper.CreateMode;
 
 public interface CreateBuilderMain extends
@@ -27,6 +30,7 @@ public interface CreateBuilderMain extends
 Compressible,
 Statable>
 {
+
 /**
  * Causes any parent nodes to get created if they haven't already been
  *
@@ -74,9 +78,14 @@ public interface CreateBuilderMain extends
  *
  * 
  * Putting the create builder into protection mode works around this.
- * The name of the node that is created is prefixed with a GUID. If 
node creation fails
- * the normal retry mechanism will occur. On the retry, the parent 
path is first searched
- * for a node that has the GUID in it. If that node is found, it is 
assumed to be the lost
+ * The name of the node that is created is prefixed with a 40 
characters string that is the concatenation of
+ * 
+ * {@value ProtectedUtils#PROTECTED_PREFIX}
+ * Canonical text representation of a random generated UUID as 
produced by {@link UUID#toString()}
+ * {@value ProtectedUtils#PROTECTED_SEPARATOR}
+ * 
+ * If node creation fails the normal retry mechanism will occur. On 
the retry, the parent path is first searched
+ * for a node that has previous described prefix in it. If that node 
is found, it is assumed to be the lost
  * node that was successfully created on the first try and is returned 
to the caller.
  * 
  *
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
index 2ccc173..cd43f07 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
@@ -64,9 +64,6 @@ public class CreateBuilderImpl implements CreateBuilder, 
CreateBuilder2, Backgro
 @VisibleForTesting
 boolean failNextCreateForTesting = false;
 
-@VisibleForTesting
-static final String PROTECTED_PREFIX = "_c_";
-
 CreateBuilderImpl(CuratorFrameworkImpl client)
 {
 this.client = client;
@@ -749,11 +746,6 @@ public class CreateBuilderImpl implements CreateBuilder, 
CreateBuilder2, Backgro
 };
 }
 
-private static String getProtectedPrefix(String protectedId)
-{
-return PROTECTED_PREFIX + protectedId + "-";
-}
-
 static  void backgroundCreateParentsThenNode(final CuratorFrameworkImpl 
client, final OperationAndData mainOperationAndData, final String path, 
Backgrounding backgrounding, final InternalACLProvider aclProvider, final 
boolean createParentsAsContainers)
 {
 BackgroundOperation operation = new BackgroundOperation()
@@ -1221,13 +1213,7 @@ public class CreateBuilderImpl implements CreateBuilder, 
CreateBuilder2, Backgro
 @VisibleForTesting
 String adjustPath(String path) throws Exception
 {
-if ( protectedMode.doProtected() )
-{
-ZKPaths.PathAndNode pathAndNode = ZKPaths.getPathAndNode(path);
-String name = getProtectedPrefix(protectedMode.protectedId()) + 
pathAndNode.getNode();
-path = ZKPaths.makePath(pathAndNode.getPath(), name);
-}
-return path;
+return ProtectedUtils.toProtectedZNodePath(path, 
pr

[curator] branch master updated: CURATOR-558 was supposed to shade all of Guava - forgot to remove the exclusions for the old guava classes that were still exposed. This was causing the installed JARs

2020-05-10 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 66c81e0  CURATOR-558 was supposed to shade all of Guava - forgot to 
remove the exclusions for the old guava classes that were still exposed. This 
was causing the installed JARs to be incorrect (missing the 3 shaded Guava 
classes) in the client JAR
66c81e0 is described below

commit 66c81e05c78519b3f82f59bcae05345e5e24c189
Author: randgalt 
AuthorDate: Sun May 10 11:15:38 2020 -0500

CURATOR-558 was supposed to shade all of Guava - forgot to remove the 
exclusions for the old guava classes that were still exposed. This was causing 
the installed JARs to be incorrect (missing the 3 shaded Guava classes) in the 
client JAR
---
 curator-client/pom.xml |  3 ---
 pom.xml| 10 --
 2 files changed, 13 deletions(-)

diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index 9d30720..18c35cb 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -108,9 +108,6 @@
 
 com.google.guava:guava
 
-
com/google/common/base/Function.class
-
com/google/common/base/Predicate.class
-
com/google/common/reflect/TypeToken.class
 META-INF/**
 
 
diff --git a/pom.xml b/pom.xml
index df45a2e..7bc7473 100644
--- a/pom.xml
+++ b/pom.xml
@@ -682,16 +682,6 @@
 
 
 
-org.apache.maven.plugins
-maven-dependency-plugin
-
-
-
-org.apache.maven.plugins
-maven-install-plugin
-
-
-
 org.apache.felix
 maven-bundle-plugin
 true



[curator] branch master updated: testDisconnectReconnectEventDoesNotFireValueWatcher() added as part of CURATOR-344 was flakey and would fail on the final assertion of numChangeEvents.get(). I don't b

2020-05-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new aa75572  testDisconnectReconnectEventDoesNotFireValueWatcher() added 
as part of CURATOR-344 was flakey and would fail on the final assertion of 
numChangeEvents.get(). I don't believe you can be assured of the exact number 
so I made it more lenient and hopefully less flakey
aa75572 is described below

commit aa755720d4092aa3f65c418e06cc714b49d26f23
Author: randgalt 
AuthorDate: Sat May 9 17:56:42 2020 -0500

testDisconnectReconnectEventDoesNotFireValueWatcher() added as part of 
CURATOR-344 was flakey and would fail on the final assertion of 
numChangeEvents.get(). I don't believe you can be assured of the exact number 
so I made it more lenient and hopefully less flakey
---
 .../org/apache/curator/framework/recipes/shared/TestSharedCount.java   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
index 2992eb9..9b6be7d 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
@@ -378,7 +378,6 @@ public class TestSharedCount extends CuratorTestBase
 
 final AtomicInteger numChangeEvents = new AtomicInteger(0);
 
-
 CuratorFramework curatorFramework = 
CuratorFrameworkFactory.newClient(server.getConnectString(), new 
RetryNTimes(10, 500));
 curatorFramework.start();
 curatorFramework.blockUntilConnected();
@@ -429,7 +428,7 @@ public class TestSharedCount extends CuratorTestBase
 
 // CURATOR-311: when a Curator client's state became RECONNECTED, 
countHasChanged method is called back
 // because the Curator client calls 
readValueAndNotifyListenersInBackground in 
SharedValue#ConnectionStateListener#stateChanged.
-Assert.assertEquals(numChangeEvents.get(), 3);
+Assert.assertTrue(numChangeEvents.get() > 2);
 }
 finally
 {



[curator] branch master updated: make testParentContainerMissing() more resilient by waiting for initial connection

2020-05-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 82304ea  make testParentContainerMissing() more resilient by waiting 
for initial connection
82304ea is described below

commit 82304ea4fcf965b2493ddf94d8ab30ef74af9068
Author: randgalt 
AuthorDate: Sat May 9 10:40:03 2020 -0500

make testParentContainerMissing() more resilient by waiting for initial 
connection
---
 .../curator/framework/recipes/cache/TestPathChildrenCache.java   | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
index 878ce48..11a25fe 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
@@ -57,7 +57,14 @@ public class TestPathChildrenCache extends BaseClassForTests
 try
 {
 client.start();
-client.blockUntilConnected();   // avoid PathChildrenCache 
connected events
+CountDownLatch startedLatch = new CountDownLatch(1);
+client.getConnectionStateListenable().addListener((__, newState) 
-> {
+if ( newState == ConnectionState.CONNECTED )
+{
+startedLatch.countDown();
+}
+});
+Assert.assertTrue(timing.awaitLatch(startedLatch));
 
 final BlockingQueue events = 
Queues.newLinkedBlockingQueue();
 PathChildrenCacheListener listener = new 
PathChildrenCacheListener()



[curator] branch master updated: testDeleteChildrenConcurrently() was badly written and error prone. I fixed it so it should run every time now

2020-05-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new d1f21cf  testDeleteChildrenConcurrently() was badly written and error 
prone. I fixed it so it should run every time now
d1f21cf is described below

commit d1f21cf7700e33bd65c44eefb4e82c0c3ba24346
Author: randgalt 
AuthorDate: Sat May 9 09:46:05 2020 -0500

testDeleteChildrenConcurrently() was badly written and error prone. I fixed 
it so it should run every time now
---
 .../curator/framework/imps/TestFrameworkEdges.java | 77 +++---
 1 file changed, 38 insertions(+), 39 deletions(-)

diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index 6fcd553..1c85c0e 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
@@ -58,6 +58,8 @@ import java.util.Random;
 import java.util.concurrent.ArrayBlockingQueue;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
@@ -786,51 +788,46 @@ public class TestFrameworkEdges extends BaseClassForTests
 {
 final CuratorFramework client = 
CuratorFrameworkFactory.newClient(server.getConnectString(), new 
RetryOneTime(1));
 CuratorFramework client2 = 
CuratorFrameworkFactory.newClient(server.getConnectString(), new 
RetryOneTime(1));
+ExecutorService executorService = Executors.newSingleThreadExecutor();
 try
 {
 client.start();
-client.getZookeeperClient().blockUntilConnectedOrTimedOut();
 client2.start();
-client2.getZookeeperClient().blockUntilConnectedOrTimedOut();
 
-int childCount = 5000;
+int childCount = 500;
 for ( int i = 0; i < childCount; i++ )
 {
 
client.create().creatingParentsIfNeeded().forPath("/parent/child" + i);
 }
 
 final CountDownLatch latch = new CountDownLatch(1);
-new Thread(new Runnable()
-{
-@Override
-public void run()
+executorService.submit(() -> {
+try
 {
-long start = System.currentTimeMillis();
-try
-{
-
client.delete().deletingChildrenIfNeeded().forPath("/parent");
-}
-catch ( Exception e )
+
client.delete().deletingChildrenIfNeeded().forPath("/parent");
+}
+catch ( InterruptedException e )
+{
+Thread.currentThread().interrupt();
+}
+catch ( Exception e )
+{
+if ( e instanceof KeeperException.NoNodeException )
 {
-if ( e instanceof KeeperException.NoNodeException )
-{
-Assert.fail("client delete failed, shouldn't throw 
NoNodeException", e);
-}
-else
-{
-Assert.fail("unexpected exception", e);
-}
+Assert.fail("client delete failed, shouldn't throw 
NoNodeException", e);
 }
-finally
+else
 {
-log.info("client has deleted children, it costs: 
{}ms", System.currentTimeMillis() - start);
-latch.countDown();
+Assert.fail("unexpected exception", e);
 }
 }
-}).start();
+finally
+{
+latch.countDown();
+}
+});
 
 boolean threadDeleted = false;
-boolean client2Deleted = false;
 Random random = new Random();
 for ( int i = 0; i < childCount; i++ )
 {
@@ -852,20 +849,16 @@ public class TestFrameworkEdges extends BaseClassForTests
 try
 {
 client2.delete().forPath(child);
-client2Deleted = true;
 log.info

[curator] branch master updated: CURATOR-544 - Fix issue with 'error code' 0 being passed to the KeeperExeception create method. This was breaking a lot of code

2020-05-08 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 5d56951  CURATOR-544 - Fix issue with 'error code' 0 being passed to 
the KeeperExeception create method. This was breaking a lot of code
5d56951 is described below

commit 5d569518ea617f30296fd3ca983034940a26529d
Author: randgalt 
AuthorDate: Fri May 8 08:00:41 2020 -0500

CURATOR-544 - Fix issue with 'error code' 0 being passed to the 
KeeperExeception create method. This was breaking a lot of code
---
 .../java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index d80c20b..218175a 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -637,7 +637,8 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 boolean doQueueOperation = false;
 do
 {
-if ( 
getZookeeperClient().getRetryPolicy().allowRetry(KeeperException.create(event.getResultCode()))
 )
+KeeperException.Code code = 
KeeperException.Code.get(event.getResultCode());
+if ( (code != KeeperException.Code.OK) && 
getZookeeperClient().getRetryPolicy().allowRetry(KeeperException.create(code)) )
 {
 doQueueOperation = checkBackgroundRetry(operationAndData, 
event);
 break;



[curator] 01/02: JIRA:CURATOR-568

2020-05-07 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 61d281721f06ba85cf3b764c332da904353fb2b0
Author: chevaris 
AuthorDate: Wed May 6 09:54:55 2020 +0200

JIRA:CURATOR-568

- Adding ensembleTracker(boolean) and withEnsembleTracker() methods to
CuratorFrameworkFactory.builder() that allows enabling/disabling
ensemble tracking
---
 .../curator/framework/CuratorFrameworkFactory.java | 25 ++
 .../framework/imps/CuratorFrameworkImpl.java   |  2 +-
 .../framework/imps/TestReconfiguration.java| 56 +-
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
index 7980e1e..37db325 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
@@ -66,6 +66,7 @@ public class CuratorFrameworkFactory
 private static final DefaultACLProvider DEFAULT_ACL_PROVIDER = new 
DefaultACLProvider();
 private static final long DEFAULT_INACTIVE_THRESHOLD_MS = 
(int)TimeUnit.MINUTES.toMillis(3);
 private static final int DEFAULT_CLOSE_WAIT_MS = 
(int)TimeUnit.SECONDS.toMillis(1);
+private static final boolean DEFAULT_WITH_ENSEMBLE_TRACKER = true;
 
 /**
  * Return a new builder that builds a CuratorFramework
@@ -129,6 +130,7 @@ public class CuratorFrameworkFactory
 public static class Builder
 {
 private EnsembleProvider ensembleProvider;
+private boolean withEnsembleTracker = DEFAULT_WITH_ENSEMBLE_TRACKER;
 private int sessionTimeoutMs = DEFAULT_SESSION_TIMEOUT_MS;
 private int connectionTimeoutMs = DEFAULT_CONNECTION_TIMEOUT_MS;
 private int maxCloseWaitMs = DEFAULT_CLOSE_WAIT_MS;
@@ -243,6 +245,29 @@ public class CuratorFrameworkFactory
 }
 
 /**
+ * Allows to configure if the ensemble configuration changes will be 
watched.
+ * The default value is {@code true}.
+ * 
+ * IMPORTANT: Use this method in combination with {@link 
#ensembleProvider(EnsembleProvider)} to provide
+ * and instance that returns {@code false} on {@link 
EnsembleProvider#updateServerListEnabled()} in order
+ * to fully achieve that ensemble server list changes are ignored
+ * 
+ * @param withTracker use {@code false} if you want to avoid following 
ensemble configuration changes
+ * @return this
+ */
+public Builder ensembleTracker(boolean withEnsembleTracker) {
+this.withEnsembleTracker = withEnsembleTracker;
+return this;
+}
+
+/**
+ * @return {@code true} if ensemble configuration changes MUST be 
watched
+ */
+public boolean withEnsembleTracker() {
+return withEnsembleTracker;
+}
+
+/**
  * Sets the data to use when {@link PathAndBytesable#forPath(String)} 
is used.
  * This is useful for debugging purposes. For example, you could set 
this to be the IP of the
  * client.
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index d4d8241..d80c20b 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -153,7 +153,7 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 failedRemoveWatcherManager = new FailedRemoveWatchManager(this);
 namespaceFacadeCache = new NamespaceFacadeCache(this);
 
-ensembleTracker = new EnsembleTracker(this, 
builder.getEnsembleProvider());
+ensembleTracker = builder.withEnsembleTracker() ? new 
EnsembleTracker(this, builder.getEnsembleProvider()) : null;
 
 runSafeService = makeRunSafeService(builder);
 }
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
index e3327e0..500e728 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestReconfiguration.java
@@ -26,6 +26,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorEventType;
+import

[curator] 02/02: JIRA:CURATOR-568

2020-05-07 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 092c1e3f34c9e53d2dbf29c37f060e47a6fb74a1
Author: chevaris 
AuthorDate: Thu May 7 09:22:30 2020 +0200

JIRA:CURATOR-568

- Javadoc typo
---
 .../java/org/apache/curator/framework/CuratorFrameworkFactory.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
index 37db325..ca5b203 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
@@ -249,10 +249,10 @@ public class CuratorFrameworkFactory
  * The default value is {@code true}.
  * 
  * IMPORTANT: Use this method in combination with {@link 
#ensembleProvider(EnsembleProvider)} to provide
- * and instance that returns {@code false} on {@link 
EnsembleProvider#updateServerListEnabled()} in order
+ * an instance that returns {@code false} on {@link 
EnsembleProvider#updateServerListEnabled()} in order
  * to fully achieve that ensemble server list changes are ignored
  * 
- * @param withTracker use {@code false} if you want to avoid following 
ensemble configuration changes
+ * @param withEnsembleTracker use {@code false} if you want to avoid 
following ensemble configuration changes
  * @return this
  */
 public Builder ensembleTracker(boolean withEnsembleTracker) {



[curator] branch master updated (5223466 -> 092c1e3)

2020-05-07 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git.


from 5223466  Document breaking changes
 new 61d2817  JIRA:CURATOR-568
 new 092c1e3  JIRA:CURATOR-568

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../curator/framework/CuratorFrameworkFactory.java | 25 ++
 .../framework/imps/CuratorFrameworkImpl.java   |  2 +-
 .../framework/imps/TestReconfiguration.java| 56 +-
 3 files changed, 80 insertions(+), 3 deletions(-)



[curator] 01/03: CURATOR-544: SessionFailedRetryPolicy

2020-05-07 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 04a861f142881ebb60fce5d8d89568385ab5
Author: tison 
AuthorDate: Mon May 4 12:51:29 2020 +0800

CURATOR-544: SessionFailedRetryPolicy
---
 .../main/java/org/apache/curator/RetryLoop.java| 32 -
 .../java/org/apache/curator/RetryLoopImpl.java |  2 +-
 .../main/java/org/apache/curator/RetryPolicy.java  | 25 +-
 .../apache/curator/SessionFailedRetryPolicy.java   | 36 +++
 .../java/org/apache/curator/TestRetryLoop.java | 53 ++
 .../curator/framework/imps/CreateBuilderImpl.java  |  5 +-
 .../framework/imps/CuratorFrameworkImpl.java   |  5 +-
 .../curator/framework/imps/DeleteBuilderImpl.java  |  2 +-
 .../framework/imps/RemoveWatchesBuilderImpl.java   |  6 +--
 9 files changed, 122 insertions(+), 44 deletions(-)

diff --git a/curator-client/src/main/java/org/apache/curator/RetryLoop.java 
b/curator-client/src/main/java/org/apache/curator/RetryLoop.java
index 1720290..070d9b3 100644
--- a/curator-client/src/main/java/org/apache/curator/RetryLoop.java
+++ b/curator-client/src/main/java/org/apache/curator/RetryLoop.java
@@ -20,7 +20,6 @@ package org.apache.curator;
 
 import org.apache.curator.connection.ThreadLocalRetryLoop;
 import org.apache.curator.utils.ThreadUtils;
-import org.apache.zookeeper.KeeperException;
 import java.util.concurrent.Callable;
 
 /**
@@ -122,37 +121,6 @@ public abstract class RetryLoop
 public abstract void markComplete();
 
 /**
- * Utility - return true if the given Zookeeper result code is retry-able
- *
- * @param rc result code
- * @return true/false
- */
-public static boolean shouldRetry(int rc)
-{
-return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) ||
-(rc == KeeperException.Code.OPERATIONTIMEOUT.intValue()) ||
-(rc == KeeperException.Code.SESSIONMOVED.intValue()) ||
-(rc == KeeperException.Code.SESSIONEXPIRED.intValue()) ||
-(rc == -13); // KeeperException.Code.NEWCONFIGNOQUORUM.intValue()) 
- using hard coded value for ZK 3.4.x compatibility
-}
-
-/**
- * Utility - return true if the given exception is retry-able
- *
- * @param exception exception to check
- * @return true/false
- */
-public static boolean isRetryException(Throwable exception)
-{
-if ( exception instanceof KeeperException )
-{
-KeeperException keeperException = (KeeperException)exception;
-return shouldRetry(keeperException.code().intValue());
-}
-return false;
-}
-
-/**
  * Pass any caught exceptions here
  *
  * @param exception the exception
diff --git a/curator-client/src/main/java/org/apache/curator/RetryLoopImpl.java 
b/curator-client/src/main/java/org/apache/curator/RetryLoopImpl.java
index bc1c244..d987f9f 100644
--- a/curator-client/src/main/java/org/apache/curator/RetryLoopImpl.java
+++ b/curator-client/src/main/java/org/apache/curator/RetryLoopImpl.java
@@ -66,7 +66,7 @@ class RetryLoopImpl extends RetryLoop
 public void takeException(Exception exception) throws Exception
 {
 boolean rethrow = true;
-if ( RetryLoop.isRetryException(exception) )
+if ( retryPolicy.allowRetry(exception) )
 {
 if ( 
!Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) )
 {
diff --git a/curator-client/src/main/java/org/apache/curator/RetryPolicy.java 
b/curator-client/src/main/java/org/apache/curator/RetryPolicy.java
index 6fca7e4..49f2e88 100644
--- a/curator-client/src/main/java/org/apache/curator/RetryPolicy.java
+++ b/curator-client/src/main/java/org/apache/curator/RetryPolicy.java
@@ -18,6 +18,8 @@
  */
 package org.apache.curator;
 
+import org.apache.zookeeper.KeeperException;
+
 /**
  * Abstracts the policy to use when retrying connections
  */
@@ -33,5 +35,26 @@ public interface RetryPolicy
  * @param sleeper use this to sleep - DO NOT call Thread.sleep
  * @return true/false
  */
-public boolean  allowRetry(int retryCount, long elapsedTimeMs, 
RetrySleeper sleeper);
+boolean allowRetry(int retryCount, long elapsedTimeMs, RetrySleeper 
sleeper);
+
+/**
+ * Called when an operation has failed with a specific exception. This 
method
+ * should return true to make another attempt.
+ *
+ * @param exception the cause that this operation failed
+ * @return true/false
+ */
+default boolean allowRetry(Throwable exception)
+{
+if ( exception instanceof KeeperException)
+{
+final int rc = ((KeeperException) exception).code().intValue();
+return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) ||
+(rc == KeeperException.Code.OPERATIONTIMEOUT.intValue

[curator] 03/03: Document breaking changes

2020-05-07 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 52234662fa10c26453c337d0503a5f40ed74ba2e
Author: tison 
AuthorDate: Thu May 7 23:58:18 2020 +0800

Document breaking changes
---
 .../org/apache/curator/SessionFailedRetryPolicy.java   | 18 ++
 src/site/confluence/breaking-changes.confluence|  8 +---
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git 
a/curator-client/src/main/java/org/apache/curator/SessionFailedRetryPolicy.java 
b/curator-client/src/main/java/org/apache/curator/SessionFailedRetryPolicy.java
index 77ad7be..07f8697 100644
--- 
a/curator-client/src/main/java/org/apache/curator/SessionFailedRetryPolicy.java
+++ 
b/curator-client/src/main/java/org/apache/curator/SessionFailedRetryPolicy.java
@@ -1,3 +1,21 @@
+/**
+ * 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;
 
 import org.apache.zookeeper.KeeperException;
diff --git a/src/site/confluence/breaking-changes.confluence 
b/src/site/confluence/breaking-changes.confluence
index af0dc04..d0530a3 100644
--- a/src/site/confluence/breaking-changes.confluence
+++ b/src/site/confluence/breaking-changes.confluence
@@ -8,6 +8,8 @@ need to use Curator with ZooKeeper 3.4.x you will need to use a 
previous version
 * Exhibitor support has been removed.
 * {{ConnectionHandlingPolicy}} and related classes have been removed.
 * The {{Reaper}} and {{ChildReaper}} classes/recipes have been removed. You 
should use ZooKeeper container nodes instead.
-* {{newPersistentEphemeralNode(}} and {{newPathChildrenCache}} were removed 
from {{GroupMember}}
-* {{ServiceCacheBuilder executorService(CloseableExecutorService 
executorService)} was removed from {{ServiceCacheBuilder}}
-* {{ServiceProviderBuilder executorService(CloseableExecutorService 
executorService);)} was removed from {{ServiceProviderBuilder}}
+* {{newPersistentEphemeralNode()}} and {{newPathChildrenCache()}} were removed 
from {{GroupMember}}.
+* {{ServiceCacheBuilder executorService(CloseableExecutorService 
executorService)}} was removed from {{ServiceCacheBuilder}}.
+* {{ServiceProviderBuilder executorService(CloseableExecutorService 
executorService)}} was removed from {{ServiceProviderBuilder}}.
+* {{static boolean shouldRetry(int rc)}} was removed from {{RetryLoop}}.
+* {{static boolean isRetryException(Throwable exception)}} was removed from 
{{RetryLoop}}.



[curator] 02/03: Address comments

2020-05-07 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit c32599670667e6c3f9b9773d3415e3b57b551fd0
Author: tison 
AuthorDate: Thu May 7 23:54:59 2020 +0800

Address comments
---
 curator-client/src/main/java/org/apache/curator/RetryPolicy.java   | 3 +--
 .../java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java   | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/curator-client/src/main/java/org/apache/curator/RetryPolicy.java 
b/curator-client/src/main/java/org/apache/curator/RetryPolicy.java
index 49f2e88..6d5d4d1 100644
--- a/curator-client/src/main/java/org/apache/curator/RetryPolicy.java
+++ b/curator-client/src/main/java/org/apache/curator/RetryPolicy.java
@@ -52,8 +52,7 @@ public interface RetryPolicy
 return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) ||
 (rc == KeeperException.Code.OPERATIONTIMEOUT.intValue()) ||
 (rc == KeeperException.Code.SESSIONMOVED.intValue()) ||
-(rc == KeeperException.Code.SESSIONEXPIRED.intValue()) ||
-(rc == -13); // 
KeeperException.Code.NEWCONFIGNOQUORUM.intValue()) - using hard coded value for 
ZK 3.4.x compatibility
+(rc == KeeperException.Code.SESSIONEXPIRED.intValue());
 }
 return false;
 }
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index e704f02..d4d8241 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -637,8 +637,7 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 boolean doQueueOperation = false;
 do
 {
-final KeeperException ke = 
KeeperException.create(event.getResultCode());
-if ( getZookeeperClient().getRetryPolicy().allowRetry(ke) )
+if ( 
getZookeeperClient().getRetryPolicy().allowRetry(KeeperException.create(event.getResultCode()))
 )
 {
 doQueueOperation = checkBackgroundRetry(operationAndData, 
event);
 break;



[curator] 01/01: Merge branch 'master' of https://gitbox.apache.org/repos/asf/curator

2020-04-21 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 192d598f1b53e6f7373f85d54488236046cd5ea2
Merge: 1e8fb6a 6ee94e1
Author: randgalt 
AuthorDate: Tue Apr 21 21:21:34 2020 -0500

Merge branch 'master' of https://gitbox.apache.org/repos/asf/curator

 pom.xml  | 2 +-
 src/site/confluence/index.confluence | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)



[curator] branch master updated (6ee94e1 -> 192d598)

2020-04-21 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git.


from 6ee94e1  [CURATOR-464] update classifier and document accordingly
 add 3d76a31  CURATOR-559 - more attempts to keep tests from failing. Make 
sure count is zeroed after server is stopped.
 add 1e8fb6a  CURATOR-559 - background thread retries are spoiling the 
test. Try to work around this
 new 192d598  Merge branch 'master' of 
https://gitbox.apache.org/repos/asf/curator

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../connection/TestThreadLocalRetryLoop.java   | 27 +++---
 1 file changed, 19 insertions(+), 8 deletions(-)



[curator] branch CURATOR-559-fix-nested-retry-loops-reopen updated (713c859 -> 1e8fb6a)

2020-04-21 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard 713c859  CURATOR-559 - background thread retries are spoiling the 
test. Try to work around this
 new 1e8fb6a  CURATOR-559 - background thread retries are spoiling the 
test. Try to work around this

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (713c859)
\
 N -- N -- N   refs/heads/CURATOR-559-fix-nested-retry-loops-reopen 
(1e8fb6a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../connection/TestThreadLocalRetryLoop.java   | 27 ++
 1 file changed, 12 insertions(+), 15 deletions(-)



[curator] 01/02: CURATOR-559 - more attempts to keep tests from failing. Make sure count is zeroed after server is stopped.

2020-04-21 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 3d76a317b68839b83e298fdd48ead1a95e5f8fe8
Author: randgalt 
AuthorDate: Sun Apr 19 14:54:04 2020 -0500

CURATOR-559 - more attempts to keep tests from failing. Make sure count is 
zeroed after server is stopped.
---
 .../org/apache/curator/connection/TestThreadLocalRetryLoop.java| 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 56362e6..686109c 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -44,7 +44,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 AtomicInteger count = new AtomicInteger();
 try (CuratorFramework client = newClient(count))
 {
-prep(client);
+prep(client, count);
 doOperation(client);
 Assert.assertEquals(count.get(), retryCount + 1);// Curator's 
retry policy has been off by 1 since inception - we might consider fixing it 
someday
 }
@@ -58,7 +58,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 AtomicInteger count = new AtomicInteger();
 try (CuratorFramework client = newClient(count))
 {
-prep(client);
+prep(client, count);
 for ( int i = 0; i < threadQty; ++i )
 {
 executorService.submit(() -> doOperation(client));
@@ -82,7 +82,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 return CuratorFrameworkFactory.newClient(server.getConnectString(), 
100, 100, retryPolicy);
 }
 
-private void prep(CuratorFramework client) throws Exception
+private void prep(CuratorFramework client, AtomicInteger count) throws 
Exception
 {
 client.start();
 client.create().forPath("/test");
@@ -94,6 +94,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 });
 server.stop();
 Assert.assertTrue(timing.awaitLatch(lostLatch));
+count.set(0);   // in case the server shutdown incremented the count
 }
 
 private Void doOperation(CuratorFramework client) throws Exception



[curator] branch CURATOR-559-fix-nested-retry-loops-reopen updated (0f9260e -> 713c859)

2020-04-21 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard 0f9260e  CURATOR-559 - background thread retries are spoiling the 
test. Try to work around this
omit 320b6e1  CURATOR-559 - more attempts to keep tests from failing. Make 
sure count is zeroed after server is stopped.
 add 1c56fc6  CURATOR-567 - TestCleanState.closeAndTestClean has meet is 
desired goal. Start removing it where it causes test flakiness
 add 1d0c6f2  Merge branch 'CURATOR-567-remove-test-clean-state-where-flaky'
 add 4fb8f2c  CURATOR-567 - At this point, TestCleanState is so flakey we 
should just turn it off for now. It's not serving much purpose anyway.
 add 629486f  Merge branch 'CURATOR-567-remove-test-clean-state-where-flaky'
 new 3d76a31  CURATOR-559 - more attempts to keep tests from failing. Make 
sure count is zeroed after server is stopped.
 new 713c859  CURATOR-559 - background thread retries are spoiling the 
test. Try to work around this

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0f9260e)
\
 N -- N -- N   refs/heads/CURATOR-559-fix-nested-retry-loops-reopen 
(713c859)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/curator/utils/DebugUtils.java   |  1 +
 .../apache/curator/framework/imps/TestCleanState.java|  4 +++-
 .../curator/connection/TestThreadLocalRetryLoop.java |  7 +++
 .../framework/recipes/shared/TestSharedCount.java| 16 +++-
 4 files changed, 14 insertions(+), 14 deletions(-)



[curator] 02/02: CURATOR-559 - background thread retries are spoiling the test. Try to work around this

2020-04-21 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 713c859a97496cf36649c93bdc36a8154f581bfa
Author: randgalt 
AuthorDate: Mon Apr 20 17:14:41 2020 -0500

CURATOR-559 - background thread retries are spoiling the test. Try to work 
around this
---
 .../connection/TestThreadLocalRetryLoop.java   | 37 +++---
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 686109c..e920bd8 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.connection;
 
+import org.apache.curator.RetryLoop;
 import org.apache.curator.RetryPolicy;
 import org.apache.curator.RetrySleeper;
 import org.apache.curator.framework.CuratorFramework;
@@ -25,6 +26,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.test.compatibility.CuratorTestBase;
+import org.apache.curator.utils.ThreadUtils;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -37,6 +39,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 public class TestThreadLocalRetryLoop extends CuratorTestBase
 {
 private static final int retryCount = 4;
+private static final String backgroundThreadNameBase = 
"ignore-curator-background-thread";
 
 @Test(description = "Check for fix for CURATOR-559")
 public void testRecursingRetry() throws Exception
@@ -79,7 +82,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 private CuratorFramework newClient(AtomicInteger count)
 {
 RetryPolicy retryPolicy = makeRetryPolicy(count);
-return CuratorFrameworkFactory.newClient(server.getConnectString(), 
100, 100, retryPolicy);
+return 
CuratorFrameworkFactory.builder().connectString(server.getConnectString()).connectionTimeoutMs(100).sessionTimeoutMs(100).retryPolicy(retryPolicy).threadFactory(ThreadUtils.newThreadFactory(backgroundThreadNameBase)).build();
 }
 
 private void prep(CuratorFramework client, AtomicInteger count) throws 
Exception
@@ -88,7 +91,8 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 client.create().forPath("/test");
 CountDownLatch lostLatch = new CountDownLatch(1);
 client.getConnectionStateListenable().addListener((__, newState) -> {
-if (newState == ConnectionState.LOST) {
+if ( newState == ConnectionState.LOST )
+{
 lostLatch.countDown();
 }
 });
@@ -99,15 +103,21 @@ public class TestThreadLocalRetryLoop extends 
CuratorTestBase
 
 private Void doOperation(CuratorFramework client) throws Exception
 {
-try
-{
-client.checkExists().forPath("/hey");
-Assert.fail("Should have thrown an exception");
-}
-catch ( KeeperException ignore )
-{
-// correct
-}
+RetryLoop.callWithRetry(client.getZookeeperClient(), () -> {
+for ( int i = 0; i < 5; ++i )   // simulate a bunch of calls in 
the same thread/call chain
+{
+try
+{
+client.checkExists().forPath("/hey");
+Assert.fail("Should have thrown an exception");
+}
+catch ( KeeperException ignore )
+{
+// correct
+}
+}
+return null;
+});
 return null;
 }
 
@@ -118,7 +128,10 @@ public class TestThreadLocalRetryLoop extends 
CuratorTestBase
 @Override
 public boolean allowRetry(int retryCount, long elapsedTimeMs, 
RetrySleeper sleeper)
 {
-count.incrementAndGet();
+if ( 
!Thread.currentThread().getName().contains(backgroundThreadNameBase) ) // if it 
does, it's Curator's background thread - don't count these
+{
+count.incrementAndGet();
+}
 return super.allowRetry(retryCount, elapsedTimeMs, sleeper);
 }
 };



[curator] branch CURATOR-559-fix-nested-retry-loops-reopen updated: CURATOR-559 - background thread retries are spoiling the test. Try to work around this

2020-04-20 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to 
refs/heads/CURATOR-559-fix-nested-retry-loops-reopen by this push:
 new 0f9260e  CURATOR-559 - background thread retries are spoiling the 
test. Try to work around this
0f9260e is described below

commit 0f9260eb89ce2378877ca7a805e85a04a7c3f135
Author: randgalt 
AuthorDate: Mon Apr 20 17:14:41 2020 -0500

CURATOR-559 - background thread retries are spoiling the test. Try to work 
around this
---
 .../connection/TestThreadLocalRetryLoop.java   | 44 ++
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 686109c..f7c997d 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -6,9 +6,9 @@
  * 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
- *
+ * 
+ * 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
@@ -16,8 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.curator.connection;
 
+import org.apache.curator.RetryLoop;
 import org.apache.curator.RetryPolicy;
 import org.apache.curator.RetrySleeper;
 import org.apache.curator.framework.CuratorFramework;
@@ -25,6 +27,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.test.compatibility.CuratorTestBase;
+import org.apache.curator.utils.ThreadUtils;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -37,6 +40,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 public class TestThreadLocalRetryLoop extends CuratorTestBase
 {
 private static final int retryCount = 4;
+private static final String backgroundThreadNameBase = 
"ignore-curator-background-thread";
 
 @Test(description = "Check for fix for CURATOR-559")
 public void testRecursingRetry() throws Exception
@@ -79,7 +83,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 private CuratorFramework newClient(AtomicInteger count)
 {
 RetryPolicy retryPolicy = makeRetryPolicy(count);
-return CuratorFrameworkFactory.newClient(server.getConnectString(), 
100, 100, retryPolicy);
+return 
CuratorFrameworkFactory.builder().connectString(server.getConnectString()).connectionTimeoutMs(100).sessionTimeoutMs(100).retryPolicy(retryPolicy).threadFactory(ThreadUtils.newThreadFactory(backgroundThreadNameBase)).build();
 }
 
 private void prep(CuratorFramework client, AtomicInteger count) throws 
Exception
@@ -88,7 +92,8 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 client.create().forPath("/test");
 CountDownLatch lostLatch = new CountDownLatch(1);
 client.getConnectionStateListenable().addListener((__, newState) -> {
-if (newState == ConnectionState.LOST) {
+if ( newState == ConnectionState.LOST )
+{
 lostLatch.countDown();
 }
 });
@@ -99,15 +104,21 @@ public class TestThreadLocalRetryLoop extends 
CuratorTestBase
 
 private Void doOperation(CuratorFramework client) throws Exception
 {
-try
-{
-client.checkExists().forPath("/hey");
-Assert.fail("Should have thrown an exception");
-}
-catch ( KeeperException ignore )
-{
-// correct
-}
+RetryLoop.callWithRetry(client.getZookeeperClient(), () -> {
+for ( int i = 0; i < 5; ++i )   // simulate a bunch of calls in 
the same thread/call chain
+{
+try
+{
+client.checkExists().forPath("/hey");
+Assert.fail("Should have thrown an exception");
+}
+catch ( KeeperException ignore )
+{
+// correct
+}
+}
+return null;
+});
 return

[curator] branch master updated: [CURATOR-464] update classifier and document accordingly

2020-04-20 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 6ee94e1  [CURATOR-464] update classifier and document accordingly
6ee94e1 is described below

commit 6ee94e1eede4ae97223b70d4a22f37be50f14533
Author: bigmarvin 
AuthorDate: Mon Apr 20 16:00:48 2020 +0800

[CURATOR-464] update classifier and document accordingly
---
 pom.xml  | 2 +-
 src/site/confluence/index.confluence | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 427037f..df45a2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -971,7 +971,7 @@
 
 
${project.build.directory}/original-${project.build.finalName}.jar
 jar
-original
+osgi
 
 
 
${skip-attaching-original-artifact}
diff --git a/src/site/confluence/index.confluence 
b/src/site/confluence/index.confluence
index 431acbe..8ea1c0e 100644
--- a/src/site/confluence/index.confluence
+++ b/src/site/confluence/index.confluence
@@ -35,6 +35,10 @@ h2. Maven / Artifacts
 Curator binaries are published to Maven Central. Curator consists of several 
artifacts. Which artifacts to use depends on your needs. For
 most users, the only artifact you need is curator\-recipes.
 
+For OSGi users, there's another set of artifacts of classifier osgi available 
in Maven Central. These artifacts are not
+shaded, thus no package relocation is performed inside, so hopefully they 
could start as bundles when their dependencies
+are fulfilled by dedicated bundles, e.g. guava.
+
 ||GroupID/Org||ArtifactID/Name||Description||
 |org.apache.curator|curator\-recipes|All of the recipes. Note: this artifact 
has dependencies on client and framework and, so, Maven (or whatever tool 
you're using) should pull those in automatically.|
 |org.apache.curator|curator\-async|Asynchronous DSL with O/R modeling, 
migrations and many other features.|



[curator] branch master updated: CURATOR-567 - At this point, TestCleanState is so flakey we should just turn it off for now. It's not serving much purpose anyway.

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 4fb8f2c  CURATOR-567 - At this point, TestCleanState is so flakey we 
should just turn it off for now. It's not serving much purpose anyway.
 new 629486f  Merge branch 'CURATOR-567-remove-test-clean-state-where-flaky'
4fb8f2c is described below

commit 4fb8f2cf1ff476dffa38eaba7fff927e528ee212
Author: randgalt 
AuthorDate: Sun Apr 19 18:26:13 2020 -0500

CURATOR-567 - At this point, TestCleanState is so flakey we should just 
turn it off for now. It's not serving much purpose anyway.
---
 curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java | 1 +
 .../test/java/org/apache/curator/framework/imps/TestCleanState.java   | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java 
b/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
index 45eea22..7ac4c4d 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
@@ -26,6 +26,7 @@ public class DebugUtils
 public static final String 
PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL = 
"curator-log-only-first-connection-issue-as-error-level";
 public static final String PROPERTY_REMOVE_WATCHERS_IN_FOREGROUND = 
"curator-remove-watchers-in-foreground";
 public static final String PROPERTY_VALIDATE_NAMESPACE_WATCHER_MAP_EMPTY = 
"curator-validate-namespace-watcher-map-empty";
+public static final String PROPERTY_VALIDATE_NO_REMAINING_WATCHERS = 
"curator-validate-no-remaining-watchers";
 
 
 private DebugUtils()
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCleanState.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCleanState.java
index b4791ff..ae1102e 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCleanState.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCleanState.java
@@ -27,9 +27,11 @@ import java.util.concurrent.Callable;
 
 public class TestCleanState
 {
+private static final boolean IS_ENABLED = 
Boolean.getBoolean("PROPERTY_VALIDATE_NO_REMAINING_WATCHERS");
+
 public static void closeAndTestClean(CuratorFramework client)
 {
-if ( client == null )
+if ( (client == null) || !IS_ENABLED )
 {
 return;
 }



[curator] branch master updated: CURATOR-567 - TestCleanState.closeAndTestClean has meet is desired goal. Start removing it where it causes test flakiness

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 1c56fc6  CURATOR-567 - TestCleanState.closeAndTestClean has meet is 
desired goal. Start removing it where it causes test flakiness
 new 1d0c6f2  Merge branch 'CURATOR-567-remove-test-clean-state-where-flaky'
1c56fc6 is described below

commit 1c56fc622c837dd98ed2b41f121309e6cd34e6fc
Author: randgalt 
AuthorDate: Sun Apr 19 16:30:42 2020 -0500

CURATOR-567 - TestCleanState.closeAndTestClean has meet is desired goal. 
Start removing it where it causes test flakiness
---
 .../framework/recipes/shared/TestSharedCount.java| 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
index 822a01c..2992eb9 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
@@ -23,7 +23,6 @@ import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.imps.TestCleanState;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
 import org.apache.curator.framework.api.CuratorWatcher;
@@ -31,7 +30,6 @@ import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.retry.RetryOneTime;
-import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
 import org.apache.curator.test.compatibility.CuratorTestBase;
 import org.apache.curator.utils.CloseableUtils;
@@ -159,7 +157,7 @@ public class TestSharedCount extends CuratorTestBase
 }
 for ( CuratorFramework client : clients )
 {
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 }
@@ -204,7 +202,7 @@ public class TestSharedCount extends CuratorTestBase
 finally
 {
 CloseableUtils.closeQuietly(count);
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -249,7 +247,7 @@ public class TestSharedCount extends CuratorTestBase
 finally
 {
 CloseableUtils.closeQuietly(count);
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -304,8 +302,8 @@ public class TestSharedCount extends CuratorTestBase
 {
 CloseableUtils.closeQuietly(count2);
 CloseableUtils.closeQuietly(count1);
-TestCleanState.closeAndTestClean(client2);
-TestCleanState.closeAndTestClean(client1);
+CloseableUtils.closeQuietly(client2);
+CloseableUtils.closeQuietly(client1);
 }
 }
 
@@ -367,7 +365,7 @@ public class TestSharedCount extends CuratorTestBase
 finally
 {
 CloseableUtils.closeQuietly(sharedCount);
-TestCleanState.closeAndTestClean(curatorFramework);
+CloseableUtils.closeQuietly(curatorFramework);
 }
 }
 
@@ -436,7 +434,7 @@ public class TestSharedCount extends CuratorTestBase
 finally
 {
 CloseableUtils.closeQuietly(sharedCount);
-TestCleanState.closeAndTestClean(curatorFramework);
+CloseableUtils.closeQuietly(curatorFramework);
 }
 }
 



[curator] branch CURATOR-559-fix-nested-retry-loops-reopen created (now 320b6e1)

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at 320b6e1  CURATOR-559 - more attempts to keep tests from failing. Make 
sure count is zeroed after server is stopped.

This branch includes the following new commits:

 new 320b6e1  CURATOR-559 - more attempts to keep tests from failing. Make 
sure count is zeroed after server is stopped.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] 01/01: CURATOR-559 - more attempts to keep tests from failing. Make sure count is zeroed after server is stopped.

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 320b6e1d76493ca8c82df6ea30bbeb1f272960ee
Author: randgalt 
AuthorDate: Sun Apr 19 14:54:04 2020 -0500

CURATOR-559 - more attempts to keep tests from failing. Make sure count is 
zeroed after server is stopped.
---
 .../org/apache/curator/connection/TestThreadLocalRetryLoop.java| 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 56362e6..686109c 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -44,7 +44,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 AtomicInteger count = new AtomicInteger();
 try (CuratorFramework client = newClient(count))
 {
-prep(client);
+prep(client, count);
 doOperation(client);
 Assert.assertEquals(count.get(), retryCount + 1);// Curator's 
retry policy has been off by 1 since inception - we might consider fixing it 
someday
 }
@@ -58,7 +58,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 AtomicInteger count = new AtomicInteger();
 try (CuratorFramework client = newClient(count))
 {
-prep(client);
+prep(client, count);
 for ( int i = 0; i < threadQty; ++i )
 {
 executorService.submit(() -> doOperation(client));
@@ -82,7 +82,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 return CuratorFrameworkFactory.newClient(server.getConnectString(), 
100, 100, retryPolicy);
 }
 
-private void prep(CuratorFramework client) throws Exception
+private void prep(CuratorFramework client, AtomicInteger count) throws 
Exception
 {
 client.start();
 client.create().forPath("/test");
@@ -94,6 +94,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 });
 server.stop();
 Assert.assertTrue(timing.awaitLatch(lostLatch));
+count.set(0);   // in case the server shutdown incremented the count
 }
 
 private Void doOperation(CuratorFramework client) throws Exception



[curator] 01/01: CURATOR-464 - make unshaded JAR classifier 'osgi' instead of 'original'

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-464-make-classifier-osgi
in repository https://gitbox.apache.org/repos/asf/curator.git

commit f1749cb6734b9793767a4d607d9039e118ef7baf
Author: randgalt 
AuthorDate: Sun Apr 19 13:21:53 2020 -0500

CURATOR-464 - make unshaded JAR classifier 'osgi' instead of 'original'
---
 pom.xml | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 427037f..28e18b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -936,6 +936,7 @@
 maven-antrun-plugin
 
 
+set-skip-attaching-original-artifact
 package
 
 run
@@ -954,6 +955,22 @@
 true
 
 
+
+rename-original-to-osgi
+package
+
+run
+
+
+
+
+
+${skip-attaching-original-artifact}
+
+
 
 
 
@@ -969,9 +986,9 @@
 
 
 
-
${project.build.directory}/original-${project.build.finalName}.jar
+
${project.build.directory}/osgi-${project.build.finalName}.jar
 jar
-original
+osgi
 
 
 
${skip-attaching-original-artifact}



[curator] branch CURATOR-464-make-classifier-osgi created (now f1749cb)

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-464-make-classifier-osgi
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at f1749cb  CURATOR-464 - make unshaded JAR classifier 'osgi' instead of 
'original'

This branch includes the following new commits:

 new f1749cb  CURATOR-464 - make unshaded JAR classifier 'osgi' instead of 
'original'

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] branch master updated (e73b034 -> 62cd345)

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git.


from e73b034  Merge branch 'master' of 
https://gitbox.apache.org/repos/asf/curator
 add 62cd345  CURATOR-559 test used InterProcessReadWriteLock - the problem 
is that the retry can end up in background loop which has its own thread 
thereby spoiling the test. Instead use a foreground operation for consistent 
tests

No new revisions were added by this update.

Summary of changes:
 .../apache/curator/connection/TestThreadLocalRetryLoop.java  | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)



[curator] 01/01: CURATOR-559 test used InterProcessReadWriteLock - the problem is that the retry can end up in background loop which has its own thread thereby spoiling the test. Instead use a foregro

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 62cd345389eacb39623a67e383a4cf38c8921f39
Author: randgalt 
AuthorDate: Sun Apr 19 10:47:57 2020 -0500

CURATOR-559 test used InterProcessReadWriteLock - the problem is that the 
retry can end up in background loop which has its own thread thereby spoiling 
the test. Instead use a foreground operation for consistent tests
---
 .../apache/curator/connection/TestThreadLocalRetryLoop.java  | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 16b345a..56362e6 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -22,7 +22,6 @@ import org.apache.curator.RetryPolicy;
 import org.apache.curator.RetrySleeper;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.test.compatibility.CuratorTestBase;
@@ -46,7 +45,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 try (CuratorFramework client = newClient(count))
 {
 prep(client);
-doLock(client);
+doOperation(client);
 Assert.assertEquals(count.get(), retryCount + 1);// Curator's 
retry policy has been off by 1 since inception - we might consider fixing it 
someday
 }
 }
@@ -62,10 +61,10 @@ public class TestThreadLocalRetryLoop extends 
CuratorTestBase
 prep(client);
 for ( int i = 0; i < threadQty; ++i )
 {
-executorService.submit(() -> doLock(client));
+executorService.submit(() -> doOperation(client));
 }
 executorService.shutdown();
-executorService.awaitTermination(timing.milliseconds(), 
TimeUnit.MILLISECONDS);
+
Assert.assertTrue(executorService.awaitTermination(timing.milliseconds(), 
TimeUnit.MILLISECONDS));
 Assert.assertEquals(count.get(), threadQty * (retryCount + 1));
// Curator's retry policy has been off by 1 since inception - we might consider 
fixing it someday
 }
 }
@@ -97,12 +96,11 @@ public class TestThreadLocalRetryLoop extends 
CuratorTestBase
 Assert.assertTrue(timing.awaitLatch(lostLatch));
 }
 
-private Void doLock(CuratorFramework client) throws Exception
+private Void doOperation(CuratorFramework client) throws Exception
 {
-InterProcessReadWriteLock lock = new InterProcessReadWriteLock(client, 
"/test/lock");
 try
 {
-lock.readLock().acquire();
+client.checkExists().forPath("/hey");
 Assert.fail("Should have thrown an exception");
 }
 catch ( KeeperException ignore )



[curator] branch CURATOR-559-fix-nested-retry-loops-reopen created (now 62cd345)

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at 62cd345  CURATOR-559 test used InterProcessReadWriteLock - the problem 
is that the retry can end up in background loop which has its own thread 
thereby spoiling the test. Instead use a foreground operation for consistent 
tests

This branch includes the following new commits:

 new 62cd345  CURATOR-559 test used InterProcessReadWriteLock - the problem 
is that the retry can end up in background loop which has its own thread 
thereby spoiling the test. Instead use a foreground operation for consistent 
tests

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] branch master updated (003f6f0 -> e73b034)

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git.


from 003f6f0  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.
 add 9c4112b  [CURATOR-464] attach orignal artifacts with classifier 
original
 add 7b19bf7  Merge branch 'master' of github.com:bigmarvin/curator into 
CURATOR-464
 add 7770d47  CURATOR-567 - remove flaky cases of TestCleanState
 new e73b034  Merge branch 'master' of 
https://gitbox.apache.org/repos/asf/curator

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../recipes/locks/TestInterProcessMutexBase.java   | 19 
 pom.xml| 56 ++
 2 files changed, 65 insertions(+), 10 deletions(-)



[curator] 01/01: Merge branch 'master' of https://gitbox.apache.org/repos/asf/curator

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit e73b0349b53ae6bbc4c684821204ac699017946d
Merge: 7770d47 003f6f0
Author: randgalt 
AuthorDate: Sun Apr 19 10:15:36 2020 -0500

Merge branch 'master' of https://gitbox.apache.org/repos/asf/curator

 .../framework/imps/CuratorFrameworkImpl.java   | 27 
 .../framework/state/ConnectionStateManager.java| 11 +++
 .../curator/framework/imps/TestFrameworkEdges.java | 36 ++
 3 files changed, 74 insertions(+)



[curator] branch CURATOR-567-remove-test-clean-state-where-flaky created (now 7770d47)

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch 
CURATOR-567-remove-test-clean-state-where-flaky
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at 7770d47  CURATOR-567 - remove flaky cases of TestCleanState

This branch includes the following new commits:

 new 7b19bf7  Merge branch 'master' of github.com:bigmarvin/curator into 
CURATOR-464
 new 7770d47  CURATOR-567 - remove flaky cases of TestCleanState

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] 02/02: CURATOR-567 - remove flaky cases of TestCleanState

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch 
CURATOR-567-remove-test-clean-state-where-flaky
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 7770d47676d8e396ce3c5b8d087de711f320092c
Author: randgalt 
AuthorDate: Sun Apr 19 09:10:32 2020 -0500

CURATOR-567 - remove flaky cases of TestCleanState
---
 .../recipes/locks/TestInterProcessMutexBase.java  | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
index bd07d6b..6e3b6ed 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
@@ -22,7 +22,6 @@ package org.apache.curator.framework.recipes.locks;
 import com.google.common.collect.Lists;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.imps.TestCleanState;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.ExponentialBackoffRetry;
@@ -150,7 +149,7 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -204,7 +203,7 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-client.close();
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -302,7 +301,7 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -333,9 +332,9 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 {
 semaphore.acquire();
 mutex.acquire();
-Assert.assertTrue(hasLock.compareAndSet(false, 
true));
 try
 {
+
Assert.assertTrue(hasLock.compareAndSet(false, true));
 if ( isFirst.compareAndSet(true, false) )
 {
 semaphore.release(THREAD_QTY - 1);
@@ -368,7 +367,7 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -414,7 +413,7 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -431,7 +430,7 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-TestCleanState.closeAndTestClean(client);
+CloseableUtils.closeQuietly(client);
 }
 }
 
@@ -569,8 +568,8 @@ public abstract class TestInterProcessMutexBase extends 
BaseClassForTests
 }
 finally
 {
-TestCleanState.closeAndTestClean(client1);
-TestCleanState.closeAndTestClean(client2);
+CloseableUtils.closeQuietly(client1);
+CloseableUtils.closeQuietly(client2);
 }
 }
 }



[curator] 01/02: Merge branch 'master' of github.com:bigmarvin/curator into CURATOR-464

2020-04-19 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch 
CURATOR-567-remove-test-clean-state-where-flaky
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 7b19bf7403e733937c8365dfe91a23edfa393658
Merge: fd3728d 9c4112b
Author: randgalt 
AuthorDate: Sat Apr 18 16:05:16 2020 -0500

Merge branch 'master' of github.com:bigmarvin/curator into CURATOR-464

 pom.xml | 56 
 1 file changed, 56 insertions(+)



[curator] branch master updated (fd3728d -> 003f6f0)

2020-04-11 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git.


from fd3728d  For CURATOR-559 make the test a bit more robust. Wait for the 
connection to go to LOST after server stop
 new a3ca8b5  CURATOR-525
 new 003f6f0  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../framework/imps/CuratorFrameworkImpl.java   | 27 
 .../framework/state/ConnectionStateManager.java| 11 +++
 .../curator/framework/imps/TestFrameworkEdges.java | 36 ++
 3 files changed, 74 insertions(+)



[curator] 02/02: CURATOR-525 - instead of resetting the connection, change the state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and needs to be addressed in the fut

2020-04-11 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 003f6f0082163889d9a1d423ad62095cc41a1366
Author: randgalt 
AuthorDate: Thu Apr 2 08:16:41 2020 -0500

CURATOR-525 - instead of resetting the connection, change the state to 
RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and 
needs to be addressed in the future.
---
 .../curator/framework/state/ConnectionStateManager.java | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 32ddb78..9ee09b0 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -291,16 +291,9 @@ public class ConnectionStateManager implements Closeable
 if ( (currentConnectionState == ConnectionState.LOST) && 
client.getZookeeperClient().isConnected() )
 {
 // CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
-// this "hack" fixes it by resetting the connection
-log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
-try
-{
-client.getZookeeperClient().reset();
-}
-catch ( Exception e )
-{
-log.error("Could not reset connection after 
LOST/isConnected mismatch");
-}
+// this "hack" fixes it by forcing the state to 
RECONNECTED
+log.warn("ConnectionState is LOST but isConnected() is 
true. Forcing RECONNECTED.");
+addStateChange(ConnectionState.RECONNECTED);
 }
 }
 }



[curator] 01/02: CURATOR-525

2020-04-11 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit a3ca8b5d159262fcd3c2fc7cdfc5c26c6c5473cd
Author: randgalt 
AuthorDate: Tue Mar 31 20:22:43 2020 -0500

CURATOR-525

There is a race whereby the ZooKeeper connection can be healed before 
Curator is finished processing the new connection state. When this happens
the Curator instance becomes a Zombie stuck in the LOST state. This fix is 
a "hack". ConnectionStateManager will notice that the connection state is
LOST but that the Curator instance reports that it is connected. When this 
happens, it is logged and the connection is reset.
---
 .../framework/imps/CuratorFrameworkImpl.java   | 27 
 .../framework/state/ConnectionStateManager.java| 18 +++
 .../curator/framework/imps/TestFrameworkEdges.java | 36 ++
 3 files changed, 81 insertions(+)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index bfe61bf..1abfc28 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -816,6 +816,13 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 return ensembleTracker;
 }
 
+@VisibleForTesting
+volatile CountDownLatch debugCheckBackgroundRetryLatch;
+@VisibleForTesting
+volatile CountDownLatch debugCheckBackgroundRetryReadyLatch;
+@VisibleForTesting
+volatile KeeperException.Code injectedCode;
+
 @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
 private  boolean 
checkBackgroundRetry(OperationAndData operationAndData, CuratorEvent 
event)
 {
@@ -851,6 +858,26 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 e = new Exception("Unknown result codegetResultCode()");
 }
 
+if ( debugCheckBackgroundRetryLatch != null )   // scaffolding 
to test CURATOR-525
+{
+if ( debugCheckBackgroundRetryReadyLatch != null )
+{
+debugCheckBackgroundRetryReadyLatch.countDown();
+}
+try
+{
+debugCheckBackgroundRetryLatch.await();
+if (injectedCode != null)
+{
+code = injectedCode;
+}
+}
+catch ( InterruptedException ex )
+{
+Thread.currentThread().interrupt();
+}
+}
+
 validateConnection(codeToState(code));
 logError("Background operation retry gave up", e);
 }
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 7285431..32ddb78 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -285,6 +285,24 @@ public class ConnectionStateManager implements Closeable
 checkSessionExpiration();
 }
 }
+
+synchronized(this)
+{
+if ( (currentConnectionState == ConnectionState.LOST) && 
client.getZookeeperClient().isConnected() )
+{
+// CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
+// this "hack" fixes it by resetting the connection
+log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
+try
+{
+client.getZookeeperClient().reset();
+}
+catch ( Exception e )
+{
+log.error("Could not reset connection after 
LOST/isConnected mismatch");
+}
+}
+}
 }
 catch ( InterruptedException e )
 {
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index 5a7c415..6fcd553 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges

[curator] branch master updated: For CURATOR-559 make the test a bit more robust. Wait for the connection to go to LOST after server stop

2020-04-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new fd3728d  For CURATOR-559 make the test a bit more robust. Wait for the 
connection to go to LOST after server stop
fd3728d is described below

commit fd3728d56366bcc9c4b3444182a8b6e7a38633a6
Author: randgalt 
AuthorDate: Thu Apr 9 10:16:05 2020 -0500

For CURATOR-559 make the test a bit more robust. Wait for the connection to 
go to LOST after server stop
---
 .../org/apache/curator/connection/TestThreadLocalRetryLoop.java  | 9 +
 1 file changed, 9 insertions(+)

diff --git 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 785c2c2..16b345a 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -23,11 +23,13 @@ import org.apache.curator.RetrySleeper;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock;
+import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.test.compatibility.CuratorTestBase;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;
 import org.testng.annotations.Test;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
@@ -85,7 +87,14 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
 {
 client.start();
 client.create().forPath("/test");
+CountDownLatch lostLatch = new CountDownLatch(1);
+client.getConnectionStateListenable().addListener((__, newState) -> {
+if (newState == ConnectionState.LOST) {
+lostLatch.countDown();
+}
+});
 server.stop();
+Assert.assertTrue(timing.awaitLatch(lostLatch));
 }
 
 private Void doLock(CuratorFramework client) throws Exception



[curator] branch master updated: CURATOR-549

2020-04-09 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new b29bb01  CURATOR-549
b29bb01 is described below

commit b29bb010ada7f17626438b828de1f9e122e5d7bf
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/CuratorCacheStorage.java |   2 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  66 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 28 files changed, 595 insertions(+), 195 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = Tree

[curator] 01/01: CURATOR-549

2020-04-08 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 3a57fbb95a700b8d56208e82378a13d3fbdbc7a2
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/CuratorCacheStorage.java |   2 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  66 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 28 files changed, 595 insertions(+), 195 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorC

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (776abad -> 3a57fbb)

2020-04-08 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


omit 776abad  CURATOR-549
omit c196079  CURATOR-549
 add 844c0ad  CURATOR-549
 new 3a57fbb  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (776abad)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (3a57fbb)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:



[curator] branch master updated: CURATOR-549

2020-04-08 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 844c0ad  CURATOR-549
844c0ad is described below

commit 844c0ad36340b695b2784489c078cfd78522143c
Author: randgalt 
AuthorDate: Sun Mar 29 15:33:13 2020 -0500

CURATOR-549

The next phase of this issue will implement a bridge cache that bridges 
TreeCache for pre 3.6 SK and CuratorCache for ZK 3.6+. That bridge will need 
this TreeCache iterator.
---
 .../curator/framework/recipes/cache/TreeCache.java |  63 ++-
 .../framework/recipes/cache/TreeCacheEvent.java|  20 ++
 .../framework/recipes/cache/TreeCacheIterator.java | 101 +++
 .../framework/recipes/cache/BaseTestTreeCache.java |  10 +
 .../cache/TestTreeCacheIteratorAndSize.java| 201 +
 .../recipes/cache/TestTreeCacheRandomTree.java |   6 +-
 6 files changed, 393 insertions(+), 8 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index 3bf804c..13b9c59 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -217,7 +218,7 @@ public class TreeCache implements Closeable
 
 private static final ChildData DEAD = new ChildData("/", null, null);
 
-private static boolean isLive(ChildData cd)
+static boolean isLive(ChildData cd)
 {
 return cd != null && cd != DEAD;
 }
@@ -226,7 +227,7 @@ public class TreeCache implements Closeable
 
 private static final AtomicReferenceFieldUpdater> childrenUpdater = 
(AtomicReferenceFieldUpdater)AtomicReferenceFieldUpdater.newUpdater(TreeNode.class,
 ConcurrentMap.class, "children");
 
-private final class TreeNode implements Watcher, BackgroundCallback
+final class TreeNode implements Watcher, BackgroundCallback
 {
 volatile ChildData childData;
 final TreeNode parent;
@@ -343,7 +344,7 @@ public class TreeCache implements Closeable
 
 if ( isLive(oldChildData) )
 {
-publishEvent(TreeCacheEvent.Type.NODE_REMOVED, oldChildData);
+publishEvent(TreeCacheEvent.Type.NODE_REMOVED, oldChildData, 
null);
 }
 
 if ( parent == null )
@@ -482,7 +483,14 @@ public class TreeCache implements Closeable
 }
 if ( childDataUpdater.compareAndSet(this, 
oldChildData, toUpdate) )
 {
-publishEvent(isLive(oldChildData) ? 
TreeCacheEvent.Type.NODE_UPDATED : TreeCacheEvent.Type.NODE_ADDED, toPublish);
+if ( isLive(oldChildData) )
+{
+publishEvent(TreeCacheEvent.Type.NODE_UPDATED, 
toPublish, oldChildData);
+}
+else
+{
+publishEvent(TreeCacheEvent.Type.NODE_ADDED, 
toPublish, null);
+}
 break;
 }
 }
@@ -750,6 +758,49 @@ public class TreeCache implements Closeable
 return isLive(result) ? result : null;
 }
 
+/**
+ * Return an iterator over all nodes in the cache. There are no
+ * guarantees of accuracy; this is merely the most recent view of the data.
+ *
+ * @return a possibly-empty iterator of nodes in the cache
+ */
+public Iterator iterator()
+{
+return new TreeCacheIterator(root);
+}
+
+/**
+ * Return the number of nodes in the cache. There are no
+ * guarantees of accuracy; this is merely the most recent view of the data.
+ *
+ * @return size
+ */
+public int size()
+{
+return size(root);
+}
+
+private int size(TreeNode node)
+{
+int size;
+if ( isLive(node.childData) )
+{
+size = 1;
+if ( node.children != null )
+{
+for ( TreeNode child : node.children.values() )
+{
+size += size(child);
+}
+}
+}
+else
+{
+size = 0;
+}
+return size;
+}
+
 private void callListeners(final TreeCacheEvent event)
 {
 listeners.forEach(listener ->

[curator] 01/01: CURATOR-549

2020-04-08 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 776abad1a8154684094c73ca4475c3d73057ce2f
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/CuratorCacheStorage.java |   2 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  66 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 28 files changed, 595 insertions(+), 195 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorC

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (b125a0b -> 776abad)

2020-04-08 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard b125a0b  CURATOR-549
 new 776abad  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b125a0b)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (776abad)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/curator/framework/recipes/cache/TestCuratorCacheBridge.java   | 1 +
 1 file changed, 1 insertion(+)



[curator] 01/01: CURATOR-525 - instead of resetting the connection, change the state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and needs to be addressed in the fut

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 10673cd90bd82db0bf9206ba30561f4c4ab01cfe
Author: randgalt 
AuthorDate: Thu Apr 2 08:16:41 2020 -0500

CURATOR-525 - instead of resetting the connection, change the state to 
RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and 
needs to be addressed in the future.
---
 .../curator/framework/state/ConnectionStateManager.java | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 32ddb78..9ee09b0 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -291,16 +291,9 @@ public class ConnectionStateManager implements Closeable
 if ( (currentConnectionState == ConnectionState.LOST) && 
client.getZookeeperClient().isConnected() )
 {
 // CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
-// this "hack" fixes it by resetting the connection
-log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
-try
-{
-client.getZookeeperClient().reset();
-}
-catch ( Exception e )
-{
-log.error("Could not reset connection after 
LOST/isConnected mismatch");
-}
+// this "hack" fixes it by forcing the state to 
RECONNECTED
+log.warn("ConnectionState is LOST but isConnected() is 
true. Forcing RECONNECTED.");
+addStateChange(ConnectionState.RECONNECTED);
 }
 }
 }



[curator] branch CURATOR-525-fix-lost-state-race updated (ebdbd21 -> 10673cd)

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard ebdbd21  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.
 new 10673cd  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ebdbd21)
\
 N -- N -- N   refs/heads/CURATOR-525-fix-lost-state-race (10673cd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/curator/framework/state/ConnectionStateManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[curator] 01/01: CURATOR-525 - instead of resetting the connection, change the state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and needs to be addressed in the fut

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 41e145d3afe296ece4623e3be32d2c7bed4e155d
Author: randgalt 
AuthorDate: Thu Apr 2 08:16:41 2020 -0500

CURATOR-525 - instead of resetting the connection, change the state to 
RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and 
needs to be addressed in the future.
---
 .../org/apache/curator/framework/state/ConnectionStateManager.java| 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 32ddb78..bdc015a 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -292,10 +292,10 @@ public class ConnectionStateManager implements Closeable
 {
 // CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
 // this "hack" fixes it by resetting the connection
-log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
+log.warn("ConnectionState is LOST but isConnected() is 
true. Forcing RECONNECTED.");
 try
 {
-client.getZookeeperClient().reset();
+addStateChange(ConnectionState.RECONNECTED);
 }
 catch ( Exception e )
 {



[curator] branch CURATOR-525-fix-lost-state-race updated (d907766 -> 41e145d)

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard d907766  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.
 new 41e145d  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d907766)
\
 N -- N -- N   refs/heads/CURATOR-525-fix-lost-state-race (41e145d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/curator/framework/state/ConnectionStateManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[curator] branch CURATOR-525-fix-lost-state-race updated (41e145d -> ebdbd21)

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard 41e145d  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.
 new ebdbd21  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (41e145d)
\
 N -- N -- N   refs/heads/CURATOR-525-fix-lost-state-race (ebdbd21)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/curator/framework/state/ConnectionStateManager.java   | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)



[curator] 01/01: CURATOR-525 - instead of resetting the connection, change the state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and needs to be addressed in the fut

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git

commit ebdbd21e949e544e2f1cb8150d1a238837bac873
Author: randgalt 
AuthorDate: Thu Apr 2 08:16:41 2020 -0500

CURATOR-525 - instead of resetting the connection, change the state to 
RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and 
needs to be addressed in the future.
---
 .../curator/framework/state/ConnectionStateManager.java   | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 32ddb78..ecf9636 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -292,15 +292,8 @@ public class ConnectionStateManager implements Closeable
 {
 // CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
 // this "hack" fixes it by resetting the connection
-log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
-try
-{
-client.getZookeeperClient().reset();
-}
-catch ( Exception e )
-{
-log.error("Could not reset connection after 
LOST/isConnected mismatch");
-}
+log.warn("ConnectionState is LOST but isConnected() is 
true. Forcing RECONNECTED.");
+addStateChange(ConnectionState.RECONNECTED);
 }
 }
 }



[curator] branch CURATOR-525-fix-lost-state-race updated (9ff0190 -> d907766)

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git.


omit 9ff0190  CURATOR-525
 add 7f9e9cc  CURATOR-549 (#335)
 new ba83de1  CURATOR-525
 new d907766  CURATOR-525 - instead of resetting the connection, change the 
state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad 
hack and needs to be addressed in the future.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (9ff0190)
\
 N -- N -- N   refs/heads/CURATOR-525-fix-lost-state-race (d907766)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/cache/CuratorCacheExample.java   |  92 +
 .../src/site/confluence/index.confluence   |   2 +-
 .../framework/state/ConnectionStateManager.java|   2 +-
 .../framework/recipes/cache/CuratorCache.java  | 136 
 .../recipes/cache/CuratorCacheAccessor.java|  75 +
 .../recipes/cache/CuratorCacheBuilder.java |  54 +++
 .../recipes/cache/CuratorCacheBuilderImpl.java |  65 
 .../framework/recipes/cache/CuratorCacheImpl.java  | 301 +
 .../recipes/cache/CuratorCacheListener.java|  78 +
 .../recipes/cache/CuratorCacheListenerBuilder.java | 129 +++
 .../cache/CuratorCacheListenerBuilderImpl.java | 161 +
 .../recipes/cache/CuratorCacheStorage.java |  88 +
 .../curator/framework/recipes/cache/NodeCache.java |   3 +
 ...peration.java => NodeCacheListenerWrapper.java} |  35 +-
 .../{EventOperation.java => OutstandingOps.java}   |  38 ++-
 .../framework/recipes/cache/PathChildrenCache.java |   4 +-
 .../cache/PathChildrenCacheListenerWrapper.java|  78 +
 .../recipes/cache/StandardCuratorCacheStorage.java |  74 
 .../curator/framework/recipes/cache/TreeCache.java |   3 +
 .../recipes/cache/TreeCacheListenerWrapper.java|  81 +
 .../framework/recipes/watch/PersistentWatcher.java | 174 ++
 .../src/site/confluence/curator-cache.confluence   |  36 ++
 .../src/site/confluence/index.confluence   |  10 +-
 .../site/confluence/persistent-watcher.confluence  |  35 ++
 .../framework/recipes/cache/TestCuratorCache.java  | 176 ++
 .../recipes/cache/TestCuratorCacheConsistency.java | 373 +
 .../recipes/cache/TestCuratorCacheEdges.java   | 148 
 .../cache/TestCuratorCacheEventOrdering.java   |  52 +++
 .../recipes/cache/TestCuratorCacheWrappers.java| 172 ++
 .../recipes/cache/TestWrappedNodeCache.java| 171 ++
 .../recipes/watch/TestPersistentWatcher.java   | 106 ++
 31 files changed, 2914 insertions(+), 38 deletions(-)
 create mode 100644 
curator-examples/src/main/java/cache/CuratorCacheExample.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCache.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheAccessor.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheBuilder.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheBuilderImpl.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheImpl.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheListener.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheListenerBuilder.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheListenerBuilderImpl.java
 create mode 100644 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CuratorCacheStorage.java
 copy 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/{EventOperation.java
 => NodeCacheListenerWrapper.java} (61%)
 copy 
curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/{EventOperation

[curator] 02/02: CURATOR-525 - instead of resetting the connection, change the state to RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and needs to be addressed in the fut

2020-04-02 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git

commit d9077664cdf9c99042ff5ff34a3aa5a665d0d829
Author: randgalt 
AuthorDate: Thu Apr 2 08:16:41 2020 -0500

CURATOR-525 - instead of resetting the connection, change the state to 
RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and 
needs to be addressed in the future.
---
 .../java/org/apache/curator/framework/state/ConnectionStateManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 32ddb78..ca631b6 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -295,7 +295,7 @@ public class ConnectionStateManager implements Closeable
 log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
 try
 {
-client.getZookeeperClient().reset();
+addStateChange(ConnectionState.RECONNECTED);
 }
 catch ( Exception e )
 {



[curator] 01/01: CURATOR-549

2020-04-01 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit b125a0b145d91faebafe4b1abfff2ae42cc1aa40
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/CuratorCacheStorage.java |   2 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  65 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 28 files changed, 594 insertions(+), 195 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorC

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (d16271a -> b125a0b)

2020-04-01 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard d16271a  CURATOR-549
 new b125a0b  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d16271a)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (b125a0b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../curator/framework/recipes/cache/CuratorCacheBridgeBuilder.java| 2 +-
 .../framework/recipes/cache/CuratorCacheBridgeBuilderImpl.java| 4 ++--
 .../apache/curator/framework/recipes/cache/CuratorCacheStorage.java   | 2 +-
 .../org/apache/curator/x/async/modeled/details/ModeledCacheImpl.java  | 2 +-
 .../java/org/apache/curator/x/discovery/details/ServiceCacheImpl.java | 2 +-
 .../org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java  | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)



[curator] 01/01: CURATOR-549

2020-04-01 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit d16271a644d62f8bdd9470dcb1cc30fafdc3f247
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  65 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 27 files changed, 593 insertions(+), 194 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorCache.Options.SINGLE_NODE_CACHE) )
+{
+   

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (5ea551f -> d16271a)

2020-04-01 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


omit 5ea551f  CURATOR-549
omit 66dbc67  CURATOR-549
omit ba859bd  CURATOR-549
 add 7f9e9cc  CURATOR-549 (#335)
 add c196079  CURATOR-549
 new d16271a  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5ea551f)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (d16271a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:



[curator] branch CURATOR-549-zk36-persistent-watcher-tree-cache-iterator updated (66dbc67 -> c196079)

2020-03-31 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch 
CURATOR-549-zk36-persistent-watcher-tree-cache-iterator
in repository https://gitbox.apache.org/repos/asf/curator.git.


omit 66dbc67  CURATOR-549
omit ba859bd  CURATOR-549
 add 7f9e9cc  CURATOR-549 (#335)
 new c196079  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (66dbc67)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-tree-cache-iterator (c196079)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:



[curator] branch master updated: CURATOR-549 (#335)

2020-03-31 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git


The following commit(s) were added to refs/heads/master by this push:
 new 7f9e9cc  CURATOR-549 (#335)
7f9e9cc is described below

commit 7f9e9cc48e04e4f6cdbea47b98ba2c602059d973
Author: Jordan Zimmerman 
AuthorDate: Tue Mar 31 22:52:41 2020 -0500

CURATOR-549 (#335)

Adds several recipes that use the new ZOOKEEPER-1416 Persistent Recursive 
watches from ZooKeeper 3.6.0. PersistentWatcher - A wrapper recipe that keeps a 
persistent (single or recursive) watch set and active through disconnections, 
etc. CuratorCache - Completely re-written cache recipe that will replace 
TreeCache, NodeCache and PathChildrenCache. With the benefit of persistent 
recursive watchers, the implementation is far simpler, will use significantly 
less resources and network call [...]

Co-authored-by: randgalt 
---
 .../src/main/java/cache/CuratorCacheExample.java   |  92 +
 .../src/site/confluence/index.confluence   |   2 +-
 .../framework/recipes/cache/CuratorCache.java  | 136 
 .../recipes/cache/CuratorCacheAccessor.java|  75 +
 .../recipes/cache/CuratorCacheBuilder.java |  54 +++
 .../recipes/cache/CuratorCacheBuilderImpl.java |  65 
 .../framework/recipes/cache/CuratorCacheImpl.java  | 301 +
 .../recipes/cache/CuratorCacheListener.java|  78 +
 .../recipes/cache/CuratorCacheListenerBuilder.java | 129 +++
 .../cache/CuratorCacheListenerBuilderImpl.java | 161 +
 .../recipes/cache/CuratorCacheStorage.java |  88 +
 .../curator/framework/recipes/cache/NodeCache.java |   3 +
 .../recipes/cache/NodeCacheListenerWrapper.java|  46 +++
 .../framework/recipes/cache/OutstandingOps.java|  55 +++
 .../framework/recipes/cache/PathChildrenCache.java |   4 +-
 .../cache/PathChildrenCacheListenerWrapper.java|  78 +
 .../recipes/cache/StandardCuratorCacheStorage.java |  74 
 .../curator/framework/recipes/cache/TreeCache.java |   3 +
 .../recipes/cache/TreeCacheListenerWrapper.java|  81 +
 .../framework/recipes/watch/PersistentWatcher.java | 174 ++
 .../src/site/confluence/curator-cache.confluence   |  36 ++
 .../src/site/confluence/index.confluence   |  10 +-
 .../site/confluence/persistent-watcher.confluence  |  35 ++
 .../framework/recipes/cache/TestCuratorCache.java  | 176 ++
 .../recipes/cache/TestCuratorCacheConsistency.java | 373 +
 .../recipes/cache/TestCuratorCacheEdges.java   | 148 
 .../cache/TestCuratorCacheEventOrdering.java   |  52 +++
 .../recipes/cache/TestCuratorCacheWrappers.java| 172 ++
 .../recipes/cache/TestWrappedNodeCache.java| 171 ++
 .../recipes/watch/TestPersistentWatcher.java   | 106 ++
 30 files changed, 2972 insertions(+), 6 deletions(-)

diff --git a/curator-examples/src/main/java/cache/CuratorCacheExample.java 
b/curator-examples/src/main/java/cache/CuratorCacheExample.java
new file mode 100644
index 000..f57923a
--- /dev/null
+++ b/curator-examples/src/main/java/cache/CuratorCacheExample.java
@@ -0,0 +1,92 @@
+/**
+ * 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 cache;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.recipes.cache.CuratorCache;
+import org.apache.curator.framework.recipes.cache.CuratorCacheListener;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.curator.test.TestingServer;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Very simple example of creating a CuratorCache that listens to events and 
logs the changes
+ * to standard out. A loop of random changes is run to exercise the cache.
+ */
+public class CuratorCacheExample
+{
+private static final String PATH = "/example/cache";
+
+public static void main(String[] args) throws Exception
+{
+ThreadLocalRandom random = ThreadLocalRandom.current();
+t

[curator] branch CURATOR-525-fix-lost-state-race updated (a1a6d62 -> 9ff0190)

2020-03-31 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard a1a6d62  CURATOR-525
 new 9ff0190  CURATOR-525

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a1a6d62)
\
 N -- N -- N   refs/heads/CURATOR-525-fix-lost-state-race (9ff0190)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../framework/state/ConnectionStateManager.java| 32 ++
 1 file changed, 20 insertions(+), 12 deletions(-)



[curator] 01/01: CURATOR-525

2020-03-31 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 9ff0190218ac5dca0054a0355b7ee7970ac4a4cb
Author: randgalt 
AuthorDate: Tue Mar 31 20:22:43 2020 -0500

CURATOR-525

There is a race whereby the ZooKeeper connection can be healed before 
Curator is finished processing the new connection state. When this happens
the Curator instance becomes a Zombie stuck in the LOST state. This fix is 
a "hack". ConnectionStateManager will notice that the connection state is
LOST but that the Curator instance reports that it is connected. When this 
happens, it is logged and the connection is reset.
---
 .../framework/imps/CuratorFrameworkImpl.java   | 27 
 .../framework/state/ConnectionStateManager.java| 18 +++
 .../curator/framework/imps/TestFrameworkEdges.java | 36 ++
 3 files changed, 81 insertions(+)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index bfe61bf..1abfc28 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -816,6 +816,13 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 return ensembleTracker;
 }
 
+@VisibleForTesting
+volatile CountDownLatch debugCheckBackgroundRetryLatch;
+@VisibleForTesting
+volatile CountDownLatch debugCheckBackgroundRetryReadyLatch;
+@VisibleForTesting
+volatile KeeperException.Code injectedCode;
+
 @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
 private  boolean 
checkBackgroundRetry(OperationAndData operationAndData, CuratorEvent 
event)
 {
@@ -851,6 +858,26 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 e = new Exception("Unknown result codegetResultCode()");
 }
 
+if ( debugCheckBackgroundRetryLatch != null )   // scaffolding 
to test CURATOR-525
+{
+if ( debugCheckBackgroundRetryReadyLatch != null )
+{
+debugCheckBackgroundRetryReadyLatch.countDown();
+}
+try
+{
+debugCheckBackgroundRetryLatch.await();
+if (injectedCode != null)
+{
+code = injectedCode;
+}
+}
+catch ( InterruptedException ex )
+{
+Thread.currentThread().interrupt();
+}
+}
+
 validateConnection(codeToState(code));
 logError("Background operation retry gave up", e);
 }
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 7285431..32ddb78 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -285,6 +285,24 @@ public class ConnectionStateManager implements Closeable
 checkSessionExpiration();
 }
 }
+
+synchronized(this)
+{
+if ( (currentConnectionState == ConnectionState.LOST) && 
client.getZookeeperClient().isConnected() )
+{
+// CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
+// this "hack" fixes it by resetting the connection
+log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
+try
+{
+client.getZookeeperClient().reset();
+}
+catch ( Exception e )
+{
+log.error("Could not reset connection after 
LOST/isConnected mismatch");
+}
+}
+}
 }
 catch ( InterruptedException e )
 {
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index 5a7c415..6fcd553 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/

[curator] branch CURATOR-525-fix-lost-state-race created (now a1a6d62)

2020-03-31 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git.


  at a1a6d62  CURATOR-525

This branch includes the following new commits:

 new a1a6d62  CURATOR-525

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[curator] 01/01: CURATOR-525

2020-03-31 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-525-fix-lost-state-race
in repository https://gitbox.apache.org/repos/asf/curator.git

commit a1a6d62d82adf3d3f561aa324968bb8d46b00e92
Author: randgalt 
AuthorDate: Tue Mar 31 20:22:43 2020 -0500

CURATOR-525

There is a race whereby the ZooKeeper connection can be healed before 
Curator is finished processing the new connection state. When this happens
the Curator instance becomes a Zombie stuck in the LOST state. This fix is 
a "hack". ConnectionStateManager will notice that the connection state is
LOST but that the Curator instance reports that it is connected. When this 
happens, it is logged and the connection is reset.
---
 .../framework/imps/CuratorFrameworkImpl.java   | 27 
 .../framework/state/ConnectionStateManager.java| 14 +++--
 .../curator/framework/imps/TestFrameworkEdges.java | 36 ++
 3 files changed, 75 insertions(+), 2 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index bfe61bf..1abfc28 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -816,6 +816,13 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 return ensembleTracker;
 }
 
+@VisibleForTesting
+volatile CountDownLatch debugCheckBackgroundRetryLatch;
+@VisibleForTesting
+volatile CountDownLatch debugCheckBackgroundRetryReadyLatch;
+@VisibleForTesting
+volatile KeeperException.Code injectedCode;
+
 @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
 private  boolean 
checkBackgroundRetry(OperationAndData operationAndData, CuratorEvent 
event)
 {
@@ -851,6 +858,26 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
 e = new Exception("Unknown result codegetResultCode()");
 }
 
+if ( debugCheckBackgroundRetryLatch != null )   // scaffolding 
to test CURATOR-525
+{
+if ( debugCheckBackgroundRetryReadyLatch != null )
+{
+debugCheckBackgroundRetryReadyLatch.countDown();
+}
+try
+{
+debugCheckBackgroundRetryLatch.await();
+if (injectedCode != null)
+{
+code = injectedCode;
+}
+}
+catch ( InterruptedException ex )
+{
+Thread.currentThread().interrupt();
+}
+}
+
 validateConnection(codeToState(code));
 logError("Background operation retry gave up", e);
 }
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 7285431..e86ebab 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -319,8 +319,18 @@ public class ConnectionStateManager implements Closeable
 {
 try
 {
-// give ConnectionState.checkTimeouts() a chance to run, reset 
ensemble providers, etc.
-client.getZookeeperClient().getZooKeeper();
+if ( client.getZookeeperClient().isConnected() )
+{
+// CURATOR-525 - there is a race whereby LOST is sometimes 
set after the connection has been repaired
+// this "hack" fixes it by resetting the connection
+log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
+client.getZookeeperClient().reset();
+}
+else
+{
+// give ConnectionState.checkTimeouts() a chance to run, 
reset ensemble providers, etc.
+client.getZookeeperClient().getZooKeeper();
+}
 }
 catch ( Exception e )
 {
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index 5a7c415..6fcd553 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (5e07178 -> 5ea551f)

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard 5e07178  CURATOR-549
 discard 104935e  CURATOR-549
 add 66dbc67  CURATOR-549
 new 5ea551f  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5e07178)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (5ea551f)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/curator/framework/recipes/cache/TreeCache.java | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)



[curator] 01/01: CURATOR-549

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 5ea551f415247142ccf9c2b727f9c9e30ac70865
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  65 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 27 files changed, 593 insertions(+), 194 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorCache.Options.SINGLE_NODE_CACHE) )
+{
+   

[curator] branch CURATOR-549-zk36-persistent-watcher-tree-cache-iterator updated (104935e -> 66dbc67)

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch 
CURATOR-549-zk36-persistent-watcher-tree-cache-iterator
in repository https://gitbox.apache.org/repos/asf/curator.git.


omit 104935e  CURATOR-549
 new 66dbc67  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (104935e)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-tree-cache-iterator (66dbc67)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/curator/framework/recipes/cache/TreeCache.java | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)



[curator] 01/01: CURATOR-549

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch 
CURATOR-549-zk36-persistent-watcher-tree-cache-iterator
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 66dbc678c6be3f75d3f1e1a6bcf81d62cd4dc392
Author: randgalt 
AuthorDate: Sun Mar 29 15:33:13 2020 -0500

CURATOR-549

The next phase of this issue will implement a bridge cache that bridges 
TreeCache for pre 3.6 SK and CuratorCache for ZK 3.6+. That bridge will need 
this TreeCache iterator.
---
 .../curator/framework/recipes/cache/TreeCache.java |  63 ++-
 .../framework/recipes/cache/TreeCacheEvent.java|  20 ++
 .../framework/recipes/cache/TreeCacheIterator.java | 101 +++
 .../framework/recipes/cache/BaseTestTreeCache.java |  10 +
 .../cache/TestTreeCacheIteratorAndSize.java| 201 +
 .../recipes/cache/TestTreeCacheRandomTree.java |   6 +-
 6 files changed, 393 insertions(+), 8 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index 3bf804c..13b9c59 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -217,7 +218,7 @@ public class TreeCache implements Closeable
 
 private static final ChildData DEAD = new ChildData("/", null, null);
 
-private static boolean isLive(ChildData cd)
+static boolean isLive(ChildData cd)
 {
 return cd != null && cd != DEAD;
 }
@@ -226,7 +227,7 @@ public class TreeCache implements Closeable
 
 private static final AtomicReferenceFieldUpdater> childrenUpdater = 
(AtomicReferenceFieldUpdater)AtomicReferenceFieldUpdater.newUpdater(TreeNode.class,
 ConcurrentMap.class, "children");
 
-private final class TreeNode implements Watcher, BackgroundCallback
+final class TreeNode implements Watcher, BackgroundCallback
 {
 volatile ChildData childData;
 final TreeNode parent;
@@ -343,7 +344,7 @@ public class TreeCache implements Closeable
 
 if ( isLive(oldChildData) )
 {
-publishEvent(TreeCacheEvent.Type.NODE_REMOVED, oldChildData);
+publishEvent(TreeCacheEvent.Type.NODE_REMOVED, oldChildData, 
null);
 }
 
 if ( parent == null )
@@ -482,7 +483,14 @@ public class TreeCache implements Closeable
 }
 if ( childDataUpdater.compareAndSet(this, 
oldChildData, toUpdate) )
 {
-publishEvent(isLive(oldChildData) ? 
TreeCacheEvent.Type.NODE_UPDATED : TreeCacheEvent.Type.NODE_ADDED, toPublish);
+if ( isLive(oldChildData) )
+{
+publishEvent(TreeCacheEvent.Type.NODE_UPDATED, 
toPublish, oldChildData);
+}
+else
+{
+publishEvent(TreeCacheEvent.Type.NODE_ADDED, 
toPublish, null);
+}
 break;
 }
 }
@@ -750,6 +758,49 @@ public class TreeCache implements Closeable
 return isLive(result) ? result : null;
 }
 
+/**
+ * Return an iterator over all nodes in the cache. There are no
+ * guarantees of accuracy; this is merely the most recent view of the data.
+ *
+ * @return a possibly-empty iterator of nodes in the cache
+ */
+public Iterator iterator()
+{
+return new TreeCacheIterator(root);
+}
+
+/**
+ * Return the number of nodes in the cache. There are no
+ * guarantees of accuracy; this is merely the most recent view of the data.
+ *
+ * @return size
+ */
+public int size()
+{
+return size(root);
+}
+
+private int size(TreeNode node)
+{
+int size;
+if ( isLive(node.childData) )
+{
+size = 1;
+if ( node.children != null )
+{
+for ( TreeNode child : node.children.values() )
+{
+size += size(child);
+}
+}
+}
+else
+{
+size = 0;
+}
+return size;
+}
+
 private void callListeners(final TreeCacheEvent event)
 {
 listeners.forEach(listener ->
@@ -837,9 +888,9 @@ public class TreeCache implements Closeable
 pu

[curator] 01/01: CURATOR-549

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 5e07178f80de2881741a840b13e7729ea51f8cec
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../recipes/cache/TreeCacheListenerWrapper.java|  15 +--
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  65 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 27 files changed, 593 insertions(+), 194 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..97293f2
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorCache.Options.SINGLE_NODE_CACHE) )
+{
+   

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (dfabb36 -> 5e07178)

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard dfabb36  CURATOR-549
 new 5e07178  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (dfabb36)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (5e07178)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../recipes/cache/CompatibleCuratorCacheBridge.java   |  2 +-
 .../framework/recipes/cache/TreeCacheListenerWrapper.java | 15 ++-
 2 files changed, 7 insertions(+), 10 deletions(-)



[curator] branch CURATOR-549-zk36-persistent-watcher-tree-cache-iterator updated (dace899 -> 104935e)

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch 
CURATOR-549-zk36-persistent-watcher-tree-cache-iterator
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard dace899  CURATOR-549
 add 104935e  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (dace899)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-tree-cache-iterator (104935e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../curator/framework/recipes/cache/TreeCache.java | 43 --
 .../framework/recipes/cache/TreeCacheEvent.java| 20 ++
 .../framework/recipes/cache/BaseTestTreeCache.java | 10 +
 ...ator.java => TestTreeCacheIteratorAndSize.java} |  8 +++-
 .../recipes/cache/TestTreeCacheRandomTree.java |  6 ++-
 5 files changed, 80 insertions(+), 7 deletions(-)
 rename 
curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/{TestTreeCacheIterator.java
 => TestTreeCacheIteratorAndSize.java} (95%)



[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (da38a53 -> dfabb36)

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard da38a53  CURATOR-549
omit dace899  CURATOR-549
 new 104935e  CURATOR-549
 new dfabb36  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (da38a53)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (dfabb36)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../cache/CompatibleCuratorCacheBridge.java|  2 +-
 .../curator/framework/recipes/cache/TreeCache.java | 43 --
 .../framework/recipes/cache/TreeCacheEvent.java| 20 ++
 .../framework/recipes/cache/BaseTestTreeCache.java | 10 +
 ...ator.java => TestTreeCacheIteratorAndSize.java} |  8 +++-
 .../recipes/cache/TestTreeCacheRandomTree.java |  6 ++-
 6 files changed, 81 insertions(+), 8 deletions(-)
 rename 
curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/{TestTreeCacheIterator.java
 => TestTreeCacheIteratorAndSize.java} (95%)



[curator] 01/02: CURATOR-549

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 104935e9a58d97cfe5ed7c8bf27a957476ba6b66
Author: randgalt 
AuthorDate: Sun Mar 29 15:33:13 2020 -0500

CURATOR-549

The next phase of this issue will implement a bridge cache that bridges 
TreeCache for pre 3.6 SK and CuratorCache for ZK 3.6+. That bridge will need 
this TreeCache iterator.
---
 .../curator/framework/recipes/cache/TreeCache.java |  59 +-
 .../framework/recipes/cache/TreeCacheEvent.java|  20 ++
 .../framework/recipes/cache/TreeCacheIterator.java | 101 +++
 .../framework/recipes/cache/BaseTestTreeCache.java |  10 +
 .../cache/TestTreeCacheIteratorAndSize.java| 201 +
 .../recipes/cache/TestTreeCacheRandomTree.java |   6 +-
 6 files changed, 389 insertions(+), 8 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index 3bf804c..e054d8b 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -217,7 +218,7 @@ public class TreeCache implements Closeable
 
 private static final ChildData DEAD = new ChildData("/", null, null);
 
-private static boolean isLive(ChildData cd)
+static boolean isLive(ChildData cd)
 {
 return cd != null && cd != DEAD;
 }
@@ -226,7 +227,7 @@ public class TreeCache implements Closeable
 
 private static final AtomicReferenceFieldUpdater> childrenUpdater = 
(AtomicReferenceFieldUpdater)AtomicReferenceFieldUpdater.newUpdater(TreeNode.class,
 ConcurrentMap.class, "children");
 
-private final class TreeNode implements Watcher, BackgroundCallback
+final class TreeNode implements Watcher, BackgroundCallback
 {
 volatile ChildData childData;
 final TreeNode parent;
@@ -343,7 +344,7 @@ public class TreeCache implements Closeable
 
 if ( isLive(oldChildData) )
 {
-publishEvent(TreeCacheEvent.Type.NODE_REMOVED, oldChildData);
+publishEvent(TreeCacheEvent.Type.NODE_REMOVED, oldChildData, 
null);
 }
 
 if ( parent == null )
@@ -482,7 +483,14 @@ public class TreeCache implements Closeable
 }
 if ( childDataUpdater.compareAndSet(this, 
oldChildData, toUpdate) )
 {
-publishEvent(isLive(oldChildData) ? 
TreeCacheEvent.Type.NODE_UPDATED : TreeCacheEvent.Type.NODE_ADDED, toPublish);
+if ( isLive(oldChildData) )
+{
+publishEvent(TreeCacheEvent.Type.NODE_UPDATED, 
toPublish, oldChildData);
+}
+else
+{
+publishEvent(TreeCacheEvent.Type.NODE_ADDED, 
toPublish, null);
+}
 break;
 }
 }
@@ -750,6 +758,45 @@ public class TreeCache implements Closeable
 return isLive(result) ? result : null;
 }
 
+/**
+ * Return an iterator over all nodes in the cache. There are no
+ * guarantees of accuracy; this is merely the most recent view of the data.
+ *
+ * @return a possibly-empty iterator of nodes in the cache
+ */
+public Iterator iterator()
+{
+return new TreeCacheIterator(root);
+}
+
+/**
+ * Return the number of nodes in the cache. There are no
+ * guarantees of accuracy; this is merely the most recent view of the data.
+ *
+ * @return size
+ */
+public int size()
+{
+return size(root);
+}
+
+private int size(TreeNode node)
+{
+int size = 0;
+if ( isLive(node.childData) )
+{
+++size;
+if ( node.children != null )
+{
+for ( TreeNode child : node.children.values() )
+{
+size += size(child);
+}
+}
+}
+return size;
+}
+
 private void callListeners(final TreeCacheEvent event)
 {
 listeners.forEach(listener ->
@@ -837,9 +884,9 @@ public class TreeCache implements Closeable
 publishEvent(new TreeCacheEvent(type, null));
 }
 
-private void pub

[curator] 02/02: CURATOR-549

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit dfabb36cdf53d704ef71b65fa02a4d7ed93a8cb8
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  65 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 26 files changed, 587 insertions(+), 185 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..38a7b1d
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorCache.Options.SINGLE_NODE_CACHE) )
+{
+builder.setMaxDepth(0);
+}

[curator] 01/01: CURATOR-549

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git

commit da38a531cdc069df0121c52f5132fbb003456581
Author: randgalt 
AuthorDate: Fri Mar 20 14:48:18 2020 -0500

CURATOR-549

Creates a simple bridge that, when using ZK 3.6.0 creates a CuratorCache, 
and for earlier versions creates a TreeCache. The curator-test-zk35 module 
ensures that both code paths are tested.
---
 .../cache/CompatibleCuratorCacheBridge.java| 144 +
 .../framework/recipes/cache/CuratorCache.java  |  15 +++
 .../recipes/cache/CuratorCacheBridge.java  |  36 ++
 .../recipes/cache/CuratorCacheBridgeBuilder.java   |  57 
 .../cache/CuratorCacheBridgeBuilderImpl.java   |  77 +++
 .../framework/recipes/cache/CuratorCacheImpl.java  |   8 +-
 .../framework/recipes/nodes/GroupMember.java   |  32 ++---
 .../recipes/cache/TestCuratorCacheBridge.java  |  65 ++
 .../framework/recipes/nodes/TestGroupMember.java   |   2 +
 .../x/async/modeled/details/ModeledCacheImpl.java  |  65 ++
 .../async/modeled/TestCachedModeledFramework.java  |   2 +
 .../apache/curator/x/discovery/ServiceCache.java   |   3 +
 .../curator/x/discovery/ServiceCacheBuilder.java   |  10 --
 .../x/discovery/ServiceProviderBuilder.java|  24 +---
 .../discovery/details/ServiceCacheBuilderImpl.java |  24 +---
 .../x/discovery/details/ServiceCacheImpl.java  |  83 +++-
 .../x/discovery/details/ServiceDiscoveryImpl.java  |  66 +-
 .../details/ServiceProviderBuilderImpl.java|   9 +-
 .../x/discovery/details/ServiceProviderImpl.java   |  24 +---
 .../x/discovery/ServiceCacheLeakTester.java|   3 +
 .../curator/x/discovery/TestServiceCache.java  |   8 ++
 .../x/discovery/details/TestServiceCacheRace.java  |   2 +
 .../x/discovery/details/TestServiceDiscovery.java  |   2 +
 .../details/TestServiceDiscoveryBuilder.java   |   6 +-
 .../x/discovery/details/TestServiceProvider.java   |   2 +
 src/site/confluence/breaking-changes.confluence|   3 +
 26 files changed, 587 insertions(+), 185 deletions(-)

diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
new file mode 100644
index 000..f64766e
--- /dev/null
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java
@@ -0,0 +1,144 @@
+/**
+ * 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.recipes.cache;
+
+import com.google.common.collect.Sets;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.listen.Listenable;
+import org.apache.curator.framework.listen.StandardListenerManager;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+
+import static 
org.apache.curator.framework.recipes.cache.CuratorCacheListener.Type.*;
+
+/**
+ * Version of CuratorCacheBridge for pre-ZK 3.6 - uses TreeCache instead of 
CuratorCache
+ */
+@SuppressWarnings("deprecation")
+class CompatibleCuratorCacheBridge implements CuratorCacheBridge, 
TreeCacheListener
+{
+private final TreeCache cache;
+private final StandardListenerManager 
listenerManager = StandardListenerManager.standard();
+
+CompatibleCuratorCacheBridge(CuratorFramework client, String path, 
CuratorCache.Options[] optionsArg, ExecutorService executorService, boolean 
cacheData)
+{
+Set options = (optionsArg != null) ? 
Sets.newHashSet(optionsArg) : Collections.emptySet();
+TreeCache.Builder builder = TreeCache.newBuilder(client, 
path).setCacheData(cacheData);
+if ( options.contains(CuratorCache.Options.SINGLE_NODE_CACHE) )
+{
+builder.setMaxDepth(0);
+}

[curator] branch CURATOR-549-zk36-persistent-watcher-bridge updated (dff747e -> da38a53)

2020-03-30 Thread randgalt
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a change to branch CURATOR-549-zk36-persistent-watcher-bridge
in repository https://gitbox.apache.org/repos/asf/curator.git.


 discard dff747e  CURATOR-549
 new da38a53  CURATOR-549

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (dff747e)
\
 N -- N -- N   
refs/heads/CURATOR-549-zk36-persistent-watcher-bridge (da38a53)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../curator/framework/recipes/cache/CompatibleCuratorCacheBridge.java   | 2 --
 1 file changed, 2 deletions(-)



  1   2   3   4   5   6   7   8   9   10   >