Replacing LockSchema with simple Set<String>

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

Branch: refs/heads/CURATOR-160
Commit: aa3dff70b2c895cd69a490d426afbdb7e6a9ae67
Parents: 72aea4a
Author: David Kesler <dkes...@yodle.com>
Authored: Mon Mar 9 14:29:52 2015 -0400
Committer: David Kesler <dkes...@yodle.com>
Committed: Mon Mar 9 14:29:52 2015 -0400

----------------------------------------------------------------------
 .../framework/recipes/locks/ChildReaper.java    | 10 +++++----
 .../recipes/locks/InterProcessSemaphoreV2.java  |  9 ++++----
 .../framework/recipes/locks/LockSchema.java     | 22 --------------------
 3 files changed, 10 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/aa3dff70/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 7935f0b..6a2c05a 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
@@ -33,7 +33,9 @@ import org.slf4j.LoggerFactory;
 import java.io.Closeable;
 import java.io.IOException;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -55,7 +57,7 @@ public class ChildReaper implements Closeable
     private final CloseableScheduledExecutorService executor;
     private final int reapingThresholdMs;
     private final LeaderLatch leaderLatch;
-    private final LockSchema lockSchema;
+    private final Set<String> lockSchema;
 
     private volatile Future<?> task;
 
@@ -109,7 +111,7 @@ public class ChildReaper implements Closeable
      */
     public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, 
ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath)
     {
-        this(client, path, mode, executor, reapingThresholdMs, leaderPath, new 
LockSchema());
+        this(client, path, mode, executor, reapingThresholdMs, leaderPath, 
Collections.<String>emptySet());
     }
 
 
@@ -122,7 +124,7 @@ public class ChildReaper implements Closeable
      * @param leaderPath if not null, uses a leader selection so that only 1 
reaper is active in the cluster
      * @param lockSchema a set of the possible subnodes of the children of 
path that must be reaped in addition to the child nodes
      */
-    public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, 
ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath, 
LockSchema lockSchema)
+    public ChildReaper(CuratorFramework client, String path, Reaper.Mode mode, 
ScheduledExecutorService executor, int reapingThresholdMs, String leaderPath, 
Set<String> lockSchema)
     {
         this.client = client;
         this.mode = mode;
@@ -226,7 +228,7 @@ public class ChildReaper implements Closeable
                     {
                         String childPath = ZKPaths.makePath(path, name);
                         addPathToReaperIfEmpty(childPath);
-                        for ( String subNode : lockSchema.getPaths() )
+                        for ( String subNode : lockSchema )
                         {
                             addPathToReaperIfEmpty(ZKPaths.makePath(childPath, 
subNode));
                         }

http://git-wip-us.apache.org/repos/asf/curator/blob/aa3dff70/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
index 55647ad..b6d5ca2 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
@@ -42,6 +42,7 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import org.apache.curator.utils.PathUtils;
 
@@ -94,11 +95,9 @@ public class InterProcessSemaphoreV2
     private static final String LOCK_PARENT = "locks";
     private static final String LEASE_PARENT = "leases";
     private static final String LEASE_BASE_NAME = "lease-";
-    public static final LockSchema LOCK_SCHEMA = new LockSchema(
-            Sets.newHashSet(
-                    LOCK_PARENT,
-                    LEASE_PARENT
-            )
+    public static final Set<String> LOCK_SCHEMA = Sets.newHashSet(
+            LOCK_PARENT,
+            LEASE_PARENT
     );
 
     /**

http://git-wip-us.apache.org/repos/asf/curator/blob/aa3dff70/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
deleted file mode 100644
index 5794705..0000000
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockSchema.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.apache.curator.framework.recipes.locks;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.google.common.collect.Sets;
-
-public class LockSchema {
-    private final Set<String> paths;
-
-    public LockSchema() {
-        paths = new HashSet<String>();
-    }
-
-    public LockSchema(Set<String> paths) {
-        this.paths = Sets.newHashSet(paths);
-    }
-
-    public Set<String> getPaths() {
-        return Sets.newHashSet(paths);
-    }
-}

Reply via email to