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 2014/02/18 10:48:43 UTC
[2/4] git commit: wip
wip
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6f21cf5d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6f21cf5d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6f21cf5d
Branch: refs/heads/CURATOR-88
Commit: 6f21cf5dce1865b873309d3dab9708dce195239d
Parents: 4ab6476
Author: randgalt <ra...@apache.org>
Authored: Mon Feb 17 17:30:37 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Feb 17 17:30:37 2014 -0500
----------------------------------------------------------------------
.../curator/x/rest/dropwizard/CuratorRestBundle.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/6f21cf5d/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
----------------------------------------------------------------------
diff --git a/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java b/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
index 2edc06f..dd8b60a 100644
--- a/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
+++ b/curator-x-rest/src/main/java/org/apache/curator/x/rest/dropwizard/CuratorRestBundle.java
@@ -63,6 +63,7 @@ public class CuratorRestBundle implements ConfiguredBundle<CuratorConfiguration>
@Override
public void lifeCycleStopping(LifeCycle event)
{
+ closeCuratorClient(context.getClient());
context.close();
}
};
@@ -71,6 +72,11 @@ public class CuratorRestBundle implements ConfiguredBundle<CuratorConfiguration>
environment.healthChecks().register("Curator", new CuratorHealthCheck(context));
}
+ protected void closeCuratorClient(CuratorFramework client)
+ {
+ client.close();
+ }
+
protected CuratorRestContext newCuratorRestContext(CuratorConfiguration configuration)
{
CuratorFramework client = newCuratorClient(configuration);
@@ -80,11 +86,8 @@ public class CuratorRestBundle implements ConfiguredBundle<CuratorConfiguration>
protected CuratorFramework newCuratorClient(CuratorConfiguration configuration)
{
ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(configuration.getRetryBaseSleepMs(), configuration.getRetryQty());
- return CuratorFrameworkFactory.newClient
- (
- configuration.getZooKeeperConnectionString(),
- configuration.getSessionLengthMs(),
- configuration.getConnectionTimeoutMs(), retryPolicy
- );
+ CuratorFramework client = CuratorFrameworkFactory.newClient(configuration.getZooKeeperConnectionString(), configuration.getSessionLengthMs(), configuration.getConnectionTimeoutMs(), retryPolicy);
+ client.start();
+ return client;
}
}