From a51ed6e356e6ce55bb5cc8110558804e6f579dbe Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 2 Jul 2013 18:50:57 +0000 Subject: [PATCH] HBASE-8812 Avoid a wide line on the HMaster webUI if we have many ZooKeeper servers git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1499056 13f79535-47bb-0310-9956-ffa450edef68 --- .../hbase/tmpl/master/MasterStatusTmpl.jamon | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index a507bd2bc27..48ff0e39820 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -57,6 +57,34 @@ ServerManager serverManager = master.getServerManager(); AssignmentManager assignmentManager = master.getAssignmentManager(); +<%class> + public String formatZKString() { + StringBuilder quorums = new StringBuilder(); + String zkQuorum = master.getZooKeeperWatcher().getQuorum(); + + if (null == zkQuorum) { + return quorums.toString(); + } + + String[] zks = zkQuorum.split(","); + + if (zks.length == 0) { + return quorums.toString(); + } + + for(int i = 0; i < zks.length; ++i) { + quorums.append(zks[i].trim()).append(","); + + if ((i+1) % 4 == 0 && i != (zks.length - 1)) { + quorums.append("
"); + } + } + + quorums.setLength(quorums.length() - 1); + return quorums.toString(); + } + + @@ -211,7 +239,8 @@ AssignmentManager assignmentManager = master.getAssignmentManager(); Zookeeper Quorum - <% master.getZooKeeperWatcher().getQuorum() %> + <%escape #n> + <% formatZKString() %> Addresses of all registered ZK servers. For more, see zk dump.