curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [2/4] git commit: wip
Date Tue, 18 Feb 2014 09:48:43 GMT
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 <randgalt@apache.org>
Authored: Mon Feb 17 17:30:37 2014 -0500
Committer: randgalt <randgalt@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;
     }
 }


Mime
View raw message