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/03/30 20:29:05 UTC
git commit: Removed 'optimization' to prevent extraneous queue
creation. I don't understand what it was supposed to do and it seems
unnecessary. It's also the cause of the test failing.
Repository: curator
Updated Branches:
refs/heads/CURATOR-95 [created] d19aff765
Removed 'optimization' to prevent extraneous queue creation. I don't understand what it was supposed to do and it seems unnecessary. It's also the cause of the test failing.
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d19aff76
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d19aff76
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d19aff76
Branch: refs/heads/CURATOR-95
Commit: d19aff765cd1b1f611408810b30b00b5bc51e8cf
Parents: bfdef2d
Author: randgalt <ra...@apache.org>
Authored: Sun Mar 30 13:28:51 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Mar 30 13:28:51 2014 -0500
----------------------------------------------------------------------
.../curator/framework/recipes/queue/QueueSharder.java | 13 +++++--------
.../framework/recipes/queue/TestQueueSharder.java | 2 +-
2 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/d19aff76/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java
index 96170bd..2dbd484 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java
@@ -242,7 +242,7 @@ public class QueueSharder<U, T extends QueueBase<U>> implements Closeable
{
try
{
- boolean addAQueue = false;
+ boolean addAQueueIfLeader = false;
int size = 0;
List<String> children = client.getChildren().forPath(queuePath);
for ( String child : children )
@@ -253,12 +253,9 @@ public class QueueSharder<U, T extends QueueBase<U>> implements Closeable
Stat stat = client.checkExists().forPath(queuePath);
if ( stat.getNumChildren() >= policies.getNewQueueThreshold() )
{
- if ( preferredQueues.contains(queuePath) ) // otherwise a queue has already been added for this
- {
- size = stat.getNumChildren();
- addAQueue = true;
- preferredQueues.remove(queuePath);
- }
+ size = stat.getNumChildren();
+ addAQueueIfLeader = true;
+ preferredQueues.remove(queuePath);
}
else if ( stat.getNumChildren() <= (policies.getNewQueueThreshold() / 2) )
{
@@ -266,7 +263,7 @@ public class QueueSharder<U, T extends QueueBase<U>> implements Closeable
}
}
- if ( addAQueue && leaderLatch.hasLeadership() )
+ if ( addAQueueIfLeader && leaderLatch.hasLeadership() )
{
if ( queues.size() < policies.getMaxQueues() )
{
http://git-wip-us.apache.org/repos/asf/curator/blob/d19aff76/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
index 78c833e..10a3428 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
@@ -117,7 +117,7 @@ public class TestQueueSharder extends BaseClassForTests
{
sharder1.getQueue().put(Integer.toString(i));
}
- timing.forWaiting().sleepABit();
+ timing.sleepABit();
Assert.assertTrue((sharder1.getShardQty() > 1) || (sharder2.getShardQty() > 1));
timing.forWaiting().sleepABit();