Merge branch 'master' into CURATOR-3.0
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d01eabe5 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d01eabe5 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d01eabe5 Branch: refs/heads/CURATOR-247 Commit: d01eabe5b3ff7624fa2bd423179316931d94c1e5 Parents: fed0bee 3801167 Author: randgalt <randg...@apache.org> Authored: Mon Aug 31 07:19:53 2015 -0700 Committer: randgalt <randg...@apache.org> Committed: Mon Aug 31 07:19:53 2015 -0700 ---------------------------------------------------------------------- .../org/apache/curator/retry/RetryForever.java | 60 ++++++++++++++++++++ .../java/org/apache/curator/TestRetryLoop.java | 20 +++++++ .../framework/recipes/cache/NodeCache.java | 41 ++++++++++--- curator-x-discovery-server/pom.xml | 6 ++ curator-x-discovery/pom.xml | 6 ++ curator-x-rpc/pom.xml | 6 ++ 6 files changed, 132 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java ---------------------------------------------------------------------- diff --cc curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java index 49b9a3f,bfc27d8..8b70db1 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java @@@ -22,11 -22,10 +22,11 @@@ import com.google.common.annotations.Vi import com.google.common.base.Function; import com.google.common.base.Objects; import com.google.common.base.Preconditions; + 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.CuratorEvent; - import org.apache.curator.framework.api.CuratorWatcher; import org.apache.curator.framework.listen.ListenerContainer; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.framework.state.ConnectionStateListener; @@@ -170,10 -178,17 +179,18 @@@ public class NodeCache implements Close { if ( state.compareAndSet(State.STARTED, State.CLOSED) ) { + client.removeWatchers(); listeners.clear(); - } - client.getConnectionStateListenable().removeListener(connectionStateListener); + client.clearWatcherReferences(watcher); + client.getConnectionStateListenable().removeListener(connectionStateListener); + + // TODO + // From PathChildrenCache + // This seems to enable even more GC - I'm not sure why yet - it + // has something to do with Guava's cache and circular references + connectionStateListener = null; + watcher = null; + } } /** http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-x-discovery-server/pom.xml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-x-discovery/pom.xml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/d01eabe5/curator-x-rpc/pom.xml ----------------------------------------------------------------------