curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [2/2] git commit: Expose leader path to ChildReaper
Date Wed, 02 Apr 2014 18:18:01 GMT
Expose leader path to ChildReaper


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/2ef7181e
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/2ef7181e
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/2ef7181e

Branch: refs/heads/master
Commit: 2ef7181ea824e0908fa42e1fe22d7a1b9a31e954
Parents: aed3c3b
Author: randgalt <randgalt@apache.org>
Authored: Wed Apr 2 13:17:28 2014 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Wed Apr 2 13:17:28 2014 -0500

----------------------------------------------------------------------
 .../framework/recipes/locks/ChildReaper.java     | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/2ef7181e/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
index 0d9a53b..2035ccc 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/ChildReaper.java
@@ -66,7 +66,7 @@ public class ChildReaper implements Closeable
      */
     public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode)
     {
-        this(client, path, mode, newExecutorService(), Reaper.DEFAULT_REAPING_THRESHOLD_MS);
+        this(client, path, mode, newExecutorService(), Reaper.DEFAULT_REAPING_THRESHOLD_MS,
null);
     }
 
     /**
@@ -77,7 +77,7 @@ public class ChildReaper implements Closeable
      */
     public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, int reapingThresholdMs)
     {
-        this(client, path, mode, newExecutorService(), reapingThresholdMs);
+        this(client, path, mode, newExecutorService(), reapingThresholdMs, null);
     }
 
     /**
@@ -89,12 +89,25 @@ public class ChildReaper implements Closeable
      */
     public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService
executor, int reapingThresholdMs)
     {
+        this(client, path, mode, executor, reapingThresholdMs, null);
+    }
+
+    /**
+     * @param client the client
+     * @param path path to reap children from
+     * @param executor executor to use for background tasks
+     * @param reapingThresholdMs threshold in milliseconds that determines that a path can
be deleted
+     * @param mode reaping mode
+     * @param leaderPath if not null, uses a leader selection so that only 1 reaper is active
in the cluster
+     */
+    public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, ScheduledExecutorService
executor, int reapingThresholdMs, String leaderPath)
+    {
         this.client = client;
         this.path = path;
         this.mode = mode;
         this.executor = new CloseableScheduledExecutorService(executor);
         this.reapingThresholdMs = reapingThresholdMs;
-        this.reaper = new Reaper(client, executor, reapingThresholdMs);
+        this.reaper = new Reaper(client, executor, reapingThresholdMs, leaderPath);
     }
 
     /**


Mime
View raw message