curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cammcken...@apache.org
Subject [46/50] curator git commit: CURATOR-224 broke the fix for CURATOR-56. Introduced a new method, makeRequeueItemPath(), so that items can be requeued in a way that's compatible with all the queue types
Date Tue, 25 Aug 2015 04:09:06 GMT
CURATOR-224 broke the fix for CURATOR-56. Introduced a new method, makeRequeueItemPath(), so
that items can be requeued in a way that's compatible with all the queue types


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

Branch: refs/heads/CURATOR-167
Commit: 2266ca1fb1414bc8306fb1d6c4ac632a841f36ec
Parents: 25f5149
Author: randgalt <randgalt@apache.org>
Authored: Fri Aug 21 13:30:48 2015 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Fri Aug 21 13:30:48 2015 -0500

----------------------------------------------------------------------
 .../framework/recipes/queue/DistributedIdQueue.java    | 13 ++++++++++++-
 .../framework/recipes/queue/DistributedQueue.java      |  7 ++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/2266ca1f/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java
index dbd8e6e..15045aa 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java
@@ -78,6 +78,12 @@ public class DistributedIdQueue<T> implements QueueBase<T>
             {
                 internalSortChildren(children);
             }
+
+            @Override
+            protected String makeRequeueItemPath(String itemPath)
+            {
+                return makeIdPath(parseId(itemPath).id);
+            }
         };
 
         if ( queue.makeItemPath().contains(Character.toString(SEPARATOR)) )
@@ -153,7 +159,7 @@ public class DistributedIdQueue<T> implements QueueBase<T>
 
         queue.checkState();
 
-        return queue.internalPut(item, null, queue.makeItemPath() + SEPARATOR + fixId(itemId)
+ SEPARATOR, maxWait, unit);
+        return queue.internalPut(item, null, makeIdPath(itemId), maxWait, unit);
     }
 
     /**
@@ -198,6 +204,11 @@ public class DistributedIdQueue<T> implements QueueBase<T>
         return false;
     }
 
+    private String makeIdPath(String itemId)
+    {
+        return queue.makeItemPath() + SEPARATOR + fixId(itemId) + SEPARATOR;
+    }
+
     private void internalSortChildren(List<String> children)
     {
         Collections.sort

http://git-wip-us.apache.org/repos/asf/curator/blob/2266ca1f/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
index 3ed3218..3b63956 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
@@ -756,7 +756,7 @@ public class DistributedQueue<T> implements QueueBase<T>
                 client.inTransaction()
                     .delete().forPath(itemPath)
                     .and()
-                    .create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(itemPath,
bytes)
+                    .create().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(makeRequeueItemPath(itemPath),
bytes)
                     .and()
                     .commit();
             }
@@ -789,4 +789,9 @@ public class DistributedQueue<T> implements QueueBase<T>
 
         return false;
     }
+
+    protected String makeRequeueItemPath(String itemPath)
+    {
+        return makeItemPath();
+    }
 }


Mime
View raw message