You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2019/10/02 23:35:28 UTC

[curator] 01/01: Merge branch 'master' into persistent-watch

This is an automated email from the ASF dual-hosted git repository.

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

commit 6580885bc895dac44e4cade1f58017054d35d5c3
Merge: d16734a f17e3e6
Author: randgalt <ra...@apache.org>
AuthorDate: Wed Oct 2 18:35:13 2019 -0500

    Merge branch 'master' into persistent-watch

 .travis.yml                                        |   4 +
 README.md                                          |   4 +
 curator-client/pom.xml                             |   8 +-
 .../java/org/apache/curator/ConnectionState.java   |   9 +-
 .../org/apache/curator/CuratorZookeeperClient.java |  54 +++-
 .../main/java/org/apache/curator/HandleHolder.java |  19 +-
 .../org/apache/curator/utils/Compatibility.java    |  45 ++-
 .../curator/utils/InjectSessionExpiration.java     |  34 +-
 .../java/org/apache/curator/utils/ZKPaths.java     | 139 ++++++--
 .../test/java/org/apache/curator/BasicTests.java   |   4 +-
 .../apache/curator/TestSessionFailRetryLoop.java   |  10 +-
 curator-examples/pom.xml                           |  14 +-
 .../src/main/java/cache/TreeCacheExample.java      |  57 ++++
 .../src/main/java/discovery/InstanceDetails.java   |   2 +-
 curator-framework/pom.xml                          |   6 +-
 .../apache/curator/framework/CuratorFramework.java |  38 ++-
 .../curator/framework/CuratorFrameworkFactory.java |  69 +++-
 .../curator/framework/imps/CreateBuilderImpl.java  | 102 +++---
 .../framework/imps/CuratorFrameworkImpl.java       | 129 +++++---
 .../framework/imps/CuratorTempFrameworkImpl.java   |   4 +-
 .../curator/framework/imps/EnsembleTracker.java    |   6 +
 .../framework/imps/GzipCompressionProvider.java    | 311 ++++++++++++++++--
 .../curator/framework/imps/OperationAndData.java   |   5 +
 .../curator/framework/imps/ProtectedMode.java      | 113 +++++++
 .../framework/listen/ListenerContainer.java        |  11 +-
 .../curator/framework/listen/ListenerManager.java  |  35 +-
 .../framework/listen/MappingListenerManager.java   | 108 +++++++
 .../framework/listen/StandardListenerManager.java  |  96 ++++++
 .../framework/listen/UnaryListenerManager.java     |  20 +-
 .../curator/framework/schema/SchemaViolation.java  |   3 +-
 .../curator/framework/state/CircuitBreaker.java    | 111 +++++++
 .../CircuitBreakingConnectionStateListener.java    | 215 +++++++++++++
 .../framework/state/CircuitBreakingManager.java    |  91 ++++++
 .../framework/state/ConnectionStateListener.java   |  15 +-
 .../ConnectionStateListenerManagerFactory.java     |  69 ++++
 .../framework/state/ConnectionStateManager.java    |  69 ++--
 .../framework/ensemble/TestEnsembleProvider.java   | 162 ++++++++++
 .../curator/framework/imps/TestCleanState.java     |   4 +-
 .../framework/imps/TestCreateReturningStat.java    |  30 ++
 .../imps/TestEnabledSessionExpiredState.java       |   4 +-
 .../curator/framework/imps/TestFramework.java      |  47 +++
 .../curator/framework/imps/TestFrameworkEdges.java | 355 +++++++++++++++++----
 .../imps/TestGzipCompressionProvider.java          | 125 ++++++++
 .../curator/framework/imps/TestRemoveWatches.java  |  12 +-
 .../curator/framework/imps/TestTtlNodes.java       |   6 +
 .../curator/framework/imps/TestWithCluster.java    |   4 +-
 .../framework/state/TestCircuitBreaker.java        |  98 ++++++
 ...TestCircuitBreakingConnectionStateListener.java | 227 +++++++++++++
 .../state/TestConnectionStateManager.java          |  82 +++++
 curator-recipes/pom.xml                            |   6 +-
 .../recipes/barriers/DistributedBarrier.java       |   7 +-
 .../recipes/barriers/DistributedDoubleBarrier.java |  14 +-
 .../framework/recipes/cache/PathChildrenCache.java |  53 ++-
 .../curator/framework/recipes/cache/TreeCache.java | 168 +++++-----
 .../framework/recipes/leader/LeaderLatch.java      |  43 ++-
 .../framework/recipes/leader/LeaderSelector.java   |  27 +-
 .../framework/recipes/locks/InterProcessLock.java  |   5 +-
 .../recipes/locks/InterProcessMultiLock.java       |   3 +
 .../framework/recipes/locks/InterProcessMutex.java |   2 +-
 .../recipes/locks/InterProcessSemaphoreMutex.java  |   7 +
 .../recipes/locks/InterProcessSemaphoreV2.java     |  32 +-
 .../framework/recipes/locks/LockInternals.java     |  44 +--
 .../framework/recipes/nodes/PersistentNode.java    |  16 +-
 .../recipes/queue/DistributedDelayQueue.java       |   2 +-
 .../framework/recipes/queue/QueueBuilder.java      |   4 +-
 .../framework/recipes/shared/SharedCount.java      |   2 +-
 .../framework/recipes/cache/BaseTestTreeCache.java |  12 +
 .../framework/recipes/cache/TestNodeCache.java     |  12 +-
 .../recipes/cache/TestPathChildrenCache.java       | 109 ++++++-
 .../framework/recipes/cache/TestTreeCache.java     |  39 ++-
 .../framework/recipes/leader/TestLeaderLatch.java  | 151 +++++++++
 .../recipes/leader/TestLeaderSelector.java         |  48 ++-
 .../recipes/locks/TestInterProcessMutex.java       |   4 +-
 .../recipes/locks/TestInterProcessMutexBase.java   |   4 +-
 .../recipes/locks/TestInterProcessSemaphore.java   |  49 +++
 .../locks/TestInterProcessSemaphoreMutex.java      |  10 +-
 .../framework/recipes/locks/TestLockACLs.java      |   4 +-
 .../recipes/nodes/TestPersistentEphemeralNode.java |  52 +--
 .../recipes/nodes/TestPersistentNode.java          |  33 ++
 .../recipes/nodes/TestPersistentTtlNode.java       |   6 +
 .../recipes/queue/TestDistributedQueue.java        |   2 +-
 curator-test-zk34/pom.xml                          |  13 +-
 .../org/apache/curator/test/Compatibility.java     |   8 -
 curator-test/pom.xml                               |   6 +-
 .../org/apache/curator/test/BaseClassForTests.java | 150 +++------
 .../org/apache/curator/test/Compatibility.java     |   7 -
 curator-x-async/pom.xml                            |  14 +-
 .../details/CachedModeledFrameworkImpl.java        |   4 +-
 .../modeled/details/ModeledFrameworkImpl.java      |   2 +-
 .../curator/framework/imps/TestFramework.java      |  29 ++
 .../async/modeled/TestCachedModeledFramework.java  |  69 +++-
 .../x/async/modeled/TestModeledFramework.java      |  10 +-
 curator-x-discovery-server/pom.xml                 |  43 ++-
 .../server/contexts/GenericDiscoveryContext.java   |   8 +-
 .../server/contexts/IntegerDiscoveryContext.java   |   4 +-
 .../server/contexts/StringDiscoveryContext.java    |   4 +-
 .../entity/JsonServiceInstanceMarshaller.java      |   6 +-
 .../entity/JsonServiceInstancesMarshaller.java     |   8 +-
 .../server/entity/JsonServiceNamesMarshaller.java  |  22 +-
 .../x/discovery/server/rest/DiscoveryContext.java  |   4 +-
 .../server/jetty_jersey/ServiceDetails.java        |   3 +-
 curator-x-discovery/pom.xml                        |  11 +-
 .../curator/x/discovery/ServiceInstance.java       |   6 +-
 .../discovery/details/JsonInstanceSerializer.java  |  12 +-
 .../x/discovery/details/OldServiceInstance.java    |   5 +-
 .../x/discovery/details/ServiceCacheImpl.java      |  22 +-
 .../TestJsonInstanceSerializerCompatibility.java   |   4 +-
 .../discovery/details/TestNewServiceInstance.java  |   5 +-
 .../x/discovery/details/TestServiceCacheRace.java  | 128 ++++++++
 .../x/discovery/details/TestServiceDiscovery.java  |   8 +-
 doap.rdf                                           |   6 +-
 pom.xml                                            | 188 ++++++++---
 src/site/confluence/errors.confluence              |   4 +-
 src/site/confluence/getting-started.confluence     |   4 +-
 src/site/confluence/index.confluence               |   8 +
 src/site/confluence/logging.confluence             |   2 +-
 src/site/confluence/utilities.confluence           |  28 ++
 src/site/confluence/zk-compatibility.confluence    |  31 +-
 src/site/site.xml                                  |  14 +-
 119 files changed, 4217 insertions(+), 838 deletions(-)

diff --cc curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index b411220,f42c1d5..cf84b03
--- 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
@@@ -27,15 -27,13 +27,18 @@@ import com.google.common.collect.Maps
  import org.apache.curator.framework.CuratorFramework;
  import org.apache.curator.framework.WatcherRemoveCuratorFramework;
  import org.apache.curator.framework.api.BackgroundCallback;
+ import org.apache.curator.framework.api.BackgroundPathable;
  import org.apache.curator.framework.api.CuratorEvent;
+ import org.apache.curator.framework.api.Pathable;
  import org.apache.curator.framework.api.UnhandledErrorListener;
+ import org.apache.curator.framework.api.Watchable;
  import org.apache.curator.framework.listen.Listenable;
  import org.apache.curator.framework.listen.ListenerContainer;
 +import org.apache.curator.framework.recipes.watch.CacheAction;
 +import org.apache.curator.framework.recipes.watch.CacheSelector;
 +import org.apache.curator.framework.recipes.watch.CacheSelectors;
 +import org.apache.curator.framework.recipes.watch.CuratorCache;
 +import org.apache.curator.framework.recipes.watch.CuratorCacheBuilder;
  import org.apache.curator.framework.state.ConnectionState;
  import org.apache.curator.framework.state.ConnectionStateListener;
  import org.apache.curator.utils.PathUtils;
@@@ -755,11 -725,18 +767,11 @@@ public class TreeCache implements TreeC
              result = builder.build();
          }
  
-         // Double-check liveness after retreiving children.
-         return node.nodeState == NodeState.LIVE ? result : null;
+         // Double-check liveness after retrieving children.
+         return isLive(node.childData) ? result : null;
      }
  
 -    /**
 -     * Return the current data for the given path. There are no guarantees of accuracy. This is
 -     * merely the most recent view of the data. If there is no node at the given path,
 -     * {@code null} is returned.
 -     *
 -     * @param fullPath full path to the node to check
 -     * @return data if the node is alive, or null
 -     */
 +    @Override
      public ChildData getCurrentData(String fullPath)
      {
          TreeNode node = find(fullPath);
diff --cc curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
index ee5e918,1e97ce2..5aaad47
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
@@@ -30,10 -29,9 +29,9 @@@ import org.apache.zookeeper.CreateMode
  import org.testng.Assert;
  import org.testng.annotations.Test;
  import java.util.concurrent.Semaphore;
- import java.util.concurrent.TimeUnit;
  import java.util.concurrent.atomic.AtomicBoolean;
  
 -public class TestTreeCache extends BaseTestTreeCache
 +public class TestTreeCache extends BaseTestTreeCache<TreeCache>
  {
      @Test
      public void testSelector() throws Exception