Repository: hbase Updated Branches: refs/heads/branch-2 e93cfb52d -> 035515d4c
HBASE-20427 thrift.jsp displays "Framed transport" incorrectly Signed-off-by: Sean Busbey <bus...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/035515d4 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/035515d4 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/035515d4 Branch: refs/heads/branch-2 Commit: 035515d4c287030732ae2b0d5aafb1c89d39e106 Parents: e93cfb5 Author: Balazs Meszaros <balazs.mesza...@cloudera.com> Authored: Mon Apr 16 16:33:48 2018 +0200 Committer: Peter Somogyi <psomo...@apache.org> Committed: Mon Apr 23 11:06:31 2018 +0200 ---------------------------------------------------------------------- .../hadoop/hbase/thrift/ThriftServerRunner.java | 24 ++++++++++++++------ .../resources/hbase-webapps/thrift/thrift.jsp | 11 +++++---- 2 files changed, 23 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/035515d4/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java ---------------------------------------------------------------------- diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java index 5d887f9..58f069c 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java @@ -139,6 +139,7 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hbase.thirdparty.com.google.common.base.Joiner; +import org.apache.hbase.thirdparty.com.google.common.base.Splitter; import org.apache.hbase.thirdparty.com.google.common.base.Throwables; import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.hbase.thirdparty.org.apache.commons.cli.CommandLine; @@ -223,7 +224,7 @@ public class ThriftServerRunner implements Runnable { private final JvmPauseMonitor pauseMonitor; /** An enum of server implementation selections */ - enum ImplType { + public enum ImplType { HS_HA("hsha", true, THsHaServer.class, true), NONBLOCKING("nonblocking", true, TNonblockingServer.class, true), THREAD_POOL("threadpool", false, TBoundedThreadPoolServer.class, true), @@ -237,7 +238,7 @@ public class ThriftServerRunner implements Runnable { final Class<? extends TServer> serverClass; final boolean canSpecifyBindIP; - ImplType(String option, boolean isAlwaysFramed, + private ImplType(String option, boolean isAlwaysFramed, Class<? extends TServer> serverClass, boolean canSpecifyBindIP) { this.option = option; this.isAlwaysFramed = isAlwaysFramed; @@ -254,7 +255,15 @@ public class ThriftServerRunner implements Runnable { return "-" + option; } - String getDescription() { + public String getOption() { + return option; + } + + public boolean isAlwaysFramed() { + return isAlwaysFramed; + } + + public String getDescription() { StringBuilder sb = new StringBuilder("Use the " + serverClass.getSimpleName()); if (isAlwaysFramed) { @@ -274,7 +283,7 @@ public class ThriftServerRunner implements Runnable { return group; } - static ImplType getServerImpl(Configuration conf) { + public static ImplType getServerImpl(Configuration conf) { String confType = conf.get(SERVER_TYPE_CONF_KEY, THREAD_POOL.option); for (ImplType t : values()) { if (confType.equals(t.option)) { @@ -1973,13 +1982,14 @@ public class ThriftServerRunner implements Runnable { public static void registerFilters(Configuration conf) { String[] filters = conf.getStrings("hbase.thrift.filters"); + Splitter splitter = Splitter.on(':'); if(filters != null) { for(String filterClass: filters) { - String[] filterPart = filterClass.split(":"); - if(filterPart.length != 2) { + List<String> filterPart = splitter.splitToList(filterClass); + if(filterPart.size() != 2) { LOG.warn("Invalid filter specification " + filterClass + " - skipping"); } else { - ParseFilter.registerFilter(filterPart[0], filterPart[1]); + ParseFilter.registerFilter(filterPart.get(0), filterPart.get(1)); } } } http://git-wip-us.apache.org/repos/asf/hbase/blob/035515d4/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp ---------------------------------------------------------------------- diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp index 579d0f7..eb329fe 100644 --- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp @@ -20,6 +20,7 @@ <%@ page contentType="text/html;charset=UTF-8" import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.hbase.HBaseConfiguration" + import="org.apache.hadoop.hbase.thrift.ThriftServerRunner.ImplType" import="org.apache.hadoop.hbase.util.VersionInfo" import="java.util.Date" %> @@ -29,9 +30,10 @@ Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf long startcode = conf.getLong("startcode", System.currentTimeMillis()); String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); String serverInfo = listenPort + "," + String.valueOf(startcode); -String implType = conf.get("hbase.regionserver.thrift.server.type", "threadpool"); +ImplType implType = ImplType.getServerImpl(conf); +String framed = implType.isAlwaysFramed() + ? "true" : conf.get("hbase.regionserver.thrift.framed", "false"); String compact = conf.get("hbase.regionserver.thrift.compact", "false"); -String framed = conf.get("hbase.regionserver.thrift.framed", "false"); %> <!DOCTYPE html> <?xml version="1.0" encoding="UTF-8" ?> @@ -69,9 +71,8 @@ String framed = conf.get("hbase.regionserver.thrift.framed", "false"); <% } %> </ul> </div><!--/.nav-collapse --> - </div> </div> - </div> + </div> <div class="container-fluid content"> <div class="row inner_header"> @@ -106,7 +107,7 @@ String framed = conf.get("hbase.regionserver.thrift.framed", "false"); </tr> <tr> <td>Thrift Impl Type</td> - <td><%= implType %></td> + <td><%= implType.getOption() %></td> <td>Thrift RPC engine implementation type chosen by this Thrift server</td> </tr> <tr>