ACCUMULO-2582 Use the DistributedWorkQueue to list the children instead of doing it by hand.
The DistributedWorkQueue also has a node for handling the locking of the children. We don't want to use that, and the name of the node is not public information. So, we should just use the queue instead of doing it by hand. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/cd78169d Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/cd78169d Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/cd78169d Branch: refs/heads/master Commit: cd78169d8925bef610331f74231cd03e8cb91323 Parents: 0f95206 Author: Josh Elser <[email protected]> Authored: Tue May 27 16:51:25 2014 -0400 Committer: Josh Elser <[email protected]> Committed: Tue May 27 16:51:25 2014 -0400 ---------------------------------------------------------------------- .../accumulo/monitor/servlets/ReplicationServlet.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/cd78169d/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java index 45f6baf..6fc8eed 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java @@ -19,7 +19,6 @@ package org.apache.accumulo.monitor.servlets; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; @@ -49,12 +48,13 @@ import org.apache.accumulo.core.replication.proto.Replication.Status; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.zookeeper.ZooUtil; -import org.apache.accumulo.fate.zookeeper.ZooReader; import org.apache.accumulo.monitor.util.Table; import org.apache.accumulo.monitor.util.celltypes.NumberType; import org.apache.accumulo.server.client.HdfsZooInstance; +import org.apache.accumulo.server.conf.ServerConfiguration; import org.apache.accumulo.server.replication.AbstractWorkAssigner; import org.apache.accumulo.server.security.SystemCredentials; +import org.apache.accumulo.server.zookeeper.DistributedWorkQueue; import org.apache.accumulo.server.zookeeper.ZooCache; import org.apache.hadoop.io.Text; import org.slf4j.Logger; @@ -202,13 +202,13 @@ public class ReplicationServlet extends BasicServlet { replicationInProgress.addSortableColumn("Peer Identifier"); replicationInProgress.addUnsortableColumn("Status"); - String zkRoot = ZooUtil.getRoot(inst); - ZooReader zreader = new ZooReader(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut()); - // Read the files from the workqueue in zk + String zkRoot = ZooUtil.getRoot(inst); final String workQueuePath = zkRoot + Constants.ZREPLICATION_WORK_QUEUE; - List<String> queuedReplication = zreader.getChildren(workQueuePath); - for (String queueKey : queuedReplication) { + + DistributedWorkQueue workQueue = new DistributedWorkQueue(workQueuePath, ServerConfiguration.getSystemConfiguration(inst)); + + for (String queueKey : workQueue.getWorkQueued()) { Entry<String,ReplicationTarget> entry = AbstractWorkAssigner.fromQueueKey(queueKey); String filename = entry.getKey(); ReplicationTarget target = entry.getValue();
