hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [01/51] [partial] hbase-site git commit: Published site at 26ac60b03f80c9215103a02db783341e67037753.
Date Thu, 10 Dec 2015 17:12:23 GMT
Repository: hbase-site
Updated Branches:
  refs/heads/asf-site 04ad6c11a -> f68717a09


http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f68717a0/devapidocs/src-html/org/apache/hadoop/hbase/ipc/RpcServer.Connection.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/RpcServer.Connection.html b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/RpcServer.Connection.html
index e7a1d18..9ba1ca2 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/RpcServer.Connection.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/RpcServer.Connection.html
@@ -2012,608 +2012,612 @@
 <span class="sourceLineNo">2004</span>      final InetSocketAddress bindAddress, Configuration conf,<a name="line.2004"></a>
 <span class="sourceLineNo">2005</span>      RpcScheduler scheduler)<a name="line.2005"></a>
 <span class="sourceLineNo">2006</span>      throws IOException {<a name="line.2006"></a>
-<span class="sourceLineNo">2007</span>    this.reservoir = new BoundedByteBufferPool(<a name="line.2007"></a>
-<span class="sourceLineNo">2008</span>      conf.getInt("hbase.ipc.server.reservoir.max.buffer.size",  1024 * 1024),<a name="line.2008"></a>
-<span class="sourceLineNo">2009</span>      conf.getInt("hbase.ipc.server.reservoir.initial.buffer.size", 16 * 1024),<a name="line.2009"></a>
-<span class="sourceLineNo">2010</span>      // Make the max twice the number of handlers to be safe.<a name="line.2010"></a>
-<span class="sourceLineNo">2011</span>      conf.getInt("hbase.ipc.server.reservoir.initial.max",<a name="line.2011"></a>
-<span class="sourceLineNo">2012</span>        conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,<a name="line.2012"></a>
-<span class="sourceLineNo">2013</span>          HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT) * 2));<a name="line.2013"></a>
-<span class="sourceLineNo">2014</span>    this.server = server;<a name="line.2014"></a>
-<span class="sourceLineNo">2015</span>    this.services = services;<a name="line.2015"></a>
-<span class="sourceLineNo">2016</span>    this.bindAddress = bindAddress;<a name="line.2016"></a>
-<span class="sourceLineNo">2017</span>    this.conf = conf;<a name="line.2017"></a>
-<span class="sourceLineNo">2018</span>    this.socketSendBufferSize = 0;<a name="line.2018"></a>
-<span class="sourceLineNo">2019</span>    this.maxQueueSize =<a name="line.2019"></a>
-<span class="sourceLineNo">2020</span>      this.conf.getInt("hbase.ipc.server.max.callqueue.size", DEFAULT_MAX_CALLQUEUE_SIZE);<a name="line.2020"></a>
-<span class="sourceLineNo">2021</span>    this.readThreads = conf.getInt("hbase.ipc.server.read.threadpool.size", 10);<a name="line.2021"></a>
-<span class="sourceLineNo">2022</span>    this.maxIdleTime = 2 * conf.getInt("hbase.ipc.client.connection.maxidletime", 1000);<a name="line.2022"></a>
-<span class="sourceLineNo">2023</span>    this.maxConnectionsToNuke = conf.getInt("hbase.ipc.client.kill.max", 10);<a name="line.2023"></a>
-<span class="sourceLineNo">2024</span>    this.thresholdIdleConnections = conf.getInt("hbase.ipc.client.idlethreshold", 4000);<a name="line.2024"></a>
-<span class="sourceLineNo">2025</span>    this.purgeTimeout = conf.getLong("hbase.ipc.client.call.purge.timeout",<a name="line.2025"></a>
-<span class="sourceLineNo">2026</span>      2 * HConstants.DEFAULT_HBASE_RPC_TIMEOUT);<a name="line.2026"></a>
-<span class="sourceLineNo">2027</span>    this.warnResponseTime = conf.getInt(WARN_RESPONSE_TIME, DEFAULT_WARN_RESPONSE_TIME);<a name="line.2027"></a>
-<span class="sourceLineNo">2028</span>    this.warnResponseSize = conf.getInt(WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_SIZE);<a name="line.2028"></a>
-<span class="sourceLineNo">2029</span><a name="line.2029"></a>
-<span class="sourceLineNo">2030</span>    // Start the listener here and let it bind to the port<a name="line.2030"></a>
-<span class="sourceLineNo">2031</span>    listener = new Listener(name);<a name="line.2031"></a>
-<span class="sourceLineNo">2032</span>    this.port = listener.getAddress().getPort();<a name="line.2032"></a>
+<span class="sourceLineNo">2007</span>    if (conf.getBoolean("hbase.ipc.server.reservoir.enabled", true)) {<a name="line.2007"></a>
+<span class="sourceLineNo">2008</span>      this.reservoir = new BoundedByteBufferPool(<a name="line.2008"></a>
+<span class="sourceLineNo">2009</span>          conf.getInt("hbase.ipc.server.reservoir.max.buffer.size", 1024 * 1024),<a name="line.2009"></a>
+<span class="sourceLineNo">2010</span>          conf.getInt("hbase.ipc.server.reservoir.initial.buffer.size", 16 * 1024),<a name="line.2010"></a>
+<span class="sourceLineNo">2011</span>          // Make the max twice the number of handlers to be safe.<a name="line.2011"></a>
+<span class="sourceLineNo">2012</span>          conf.getInt("hbase.ipc.server.reservoir.initial.max",<a name="line.2012"></a>
+<span class="sourceLineNo">2013</span>              conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,<a name="line.2013"></a>
+<span class="sourceLineNo">2014</span>                  HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT) * 2));<a name="line.2014"></a>
+<span class="sourceLineNo">2015</span>    } else {<a name="line.2015"></a>
+<span class="sourceLineNo">2016</span>      reservoir = null;<a name="line.2016"></a>
+<span class="sourceLineNo">2017</span>    }<a name="line.2017"></a>
+<span class="sourceLineNo">2018</span>    this.server = server;<a name="line.2018"></a>
+<span class="sourceLineNo">2019</span>    this.services = services;<a name="line.2019"></a>
+<span class="sourceLineNo">2020</span>    this.bindAddress = bindAddress;<a name="line.2020"></a>
+<span class="sourceLineNo">2021</span>    this.conf = conf;<a name="line.2021"></a>
+<span class="sourceLineNo">2022</span>    this.socketSendBufferSize = 0;<a name="line.2022"></a>
+<span class="sourceLineNo">2023</span>    this.maxQueueSize =<a name="line.2023"></a>
+<span class="sourceLineNo">2024</span>      this.conf.getInt("hbase.ipc.server.max.callqueue.size", DEFAULT_MAX_CALLQUEUE_SIZE);<a name="line.2024"></a>
+<span class="sourceLineNo">2025</span>    this.readThreads = conf.getInt("hbase.ipc.server.read.threadpool.size", 10);<a name="line.2025"></a>
+<span class="sourceLineNo">2026</span>    this.maxIdleTime = 2 * conf.getInt("hbase.ipc.client.connection.maxidletime", 1000);<a name="line.2026"></a>
+<span class="sourceLineNo">2027</span>    this.maxConnectionsToNuke = conf.getInt("hbase.ipc.client.kill.max", 10);<a name="line.2027"></a>
+<span class="sourceLineNo">2028</span>    this.thresholdIdleConnections = conf.getInt("hbase.ipc.client.idlethreshold", 4000);<a name="line.2028"></a>
+<span class="sourceLineNo">2029</span>    this.purgeTimeout = conf.getLong("hbase.ipc.client.call.purge.timeout",<a name="line.2029"></a>
+<span class="sourceLineNo">2030</span>      2 * HConstants.DEFAULT_HBASE_RPC_TIMEOUT);<a name="line.2030"></a>
+<span class="sourceLineNo">2031</span>    this.warnResponseTime = conf.getInt(WARN_RESPONSE_TIME, DEFAULT_WARN_RESPONSE_TIME);<a name="line.2031"></a>
+<span class="sourceLineNo">2032</span>    this.warnResponseSize = conf.getInt(WARN_RESPONSE_SIZE, DEFAULT_WARN_RESPONSE_SIZE);<a name="line.2032"></a>
 <span class="sourceLineNo">2033</span><a name="line.2033"></a>
-<span class="sourceLineNo">2034</span>    this.metrics = new MetricsHBaseServer(name, new MetricsHBaseServerWrapperImpl(this));<a name="line.2034"></a>
-<span class="sourceLineNo">2035</span>    this.tcpNoDelay = conf.getBoolean("hbase.ipc.server.tcpnodelay", true);<a name="line.2035"></a>
-<span class="sourceLineNo">2036</span>    this.tcpKeepAlive = conf.getBoolean("hbase.ipc.server.tcpkeepalive", true);<a name="line.2036"></a>
+<span class="sourceLineNo">2034</span>    // Start the listener here and let it bind to the port<a name="line.2034"></a>
+<span class="sourceLineNo">2035</span>    listener = new Listener(name);<a name="line.2035"></a>
+<span class="sourceLineNo">2036</span>    this.port = listener.getAddress().getPort();<a name="line.2036"></a>
 <span class="sourceLineNo">2037</span><a name="line.2037"></a>
-<span class="sourceLineNo">2038</span>    this.warnDelayedCalls = conf.getInt(WARN_DELAYED_CALLS, DEFAULT_WARN_DELAYED_CALLS);<a name="line.2038"></a>
-<span class="sourceLineNo">2039</span>    this.delayedCalls = new AtomicInteger(0);<a name="line.2039"></a>
-<span class="sourceLineNo">2040</span>    this.ipcUtil = new IPCUtil(conf);<a name="line.2040"></a>
+<span class="sourceLineNo">2038</span>    this.metrics = new MetricsHBaseServer(name, new MetricsHBaseServerWrapperImpl(this));<a name="line.2038"></a>
+<span class="sourceLineNo">2039</span>    this.tcpNoDelay = conf.getBoolean("hbase.ipc.server.tcpnodelay", true);<a name="line.2039"></a>
+<span class="sourceLineNo">2040</span>    this.tcpKeepAlive = conf.getBoolean("hbase.ipc.server.tcpkeepalive", true);<a name="line.2040"></a>
 <span class="sourceLineNo">2041</span><a name="line.2041"></a>
-<span class="sourceLineNo">2042</span><a name="line.2042"></a>
-<span class="sourceLineNo">2043</span>    // Create the responder here<a name="line.2043"></a>
-<span class="sourceLineNo">2044</span>    responder = new Responder();<a name="line.2044"></a>
-<span class="sourceLineNo">2045</span>    this.authorize = conf.getBoolean(HADOOP_SECURITY_AUTHORIZATION, false);<a name="line.2045"></a>
-<span class="sourceLineNo">2046</span>    this.userProvider = UserProvider.instantiate(conf);<a name="line.2046"></a>
-<span class="sourceLineNo">2047</span>    this.isSecurityEnabled = userProvider.isHBaseSecurityEnabled();<a name="line.2047"></a>
-<span class="sourceLineNo">2048</span>    if (isSecurityEnabled) {<a name="line.2048"></a>
-<span class="sourceLineNo">2049</span>      HBaseSaslRpcServer.init(conf);<a name="line.2049"></a>
-<span class="sourceLineNo">2050</span>    }<a name="line.2050"></a>
-<span class="sourceLineNo">2051</span>    initReconfigurable(conf);<a name="line.2051"></a>
-<span class="sourceLineNo">2052</span><a name="line.2052"></a>
-<span class="sourceLineNo">2053</span>    this.scheduler = scheduler;<a name="line.2053"></a>
-<span class="sourceLineNo">2054</span>    this.scheduler.init(new RpcSchedulerContext(this));<a name="line.2054"></a>
-<span class="sourceLineNo">2055</span>  }<a name="line.2055"></a>
+<span class="sourceLineNo">2042</span>    this.warnDelayedCalls = conf.getInt(WARN_DELAYED_CALLS, DEFAULT_WARN_DELAYED_CALLS);<a name="line.2042"></a>
+<span class="sourceLineNo">2043</span>    this.delayedCalls = new AtomicInteger(0);<a name="line.2043"></a>
+<span class="sourceLineNo">2044</span>    this.ipcUtil = new IPCUtil(conf);<a name="line.2044"></a>
+<span class="sourceLineNo">2045</span><a name="line.2045"></a>
+<span class="sourceLineNo">2046</span><a name="line.2046"></a>
+<span class="sourceLineNo">2047</span>    // Create the responder here<a name="line.2047"></a>
+<span class="sourceLineNo">2048</span>    responder = new Responder();<a name="line.2048"></a>
+<span class="sourceLineNo">2049</span>    this.authorize = conf.getBoolean(HADOOP_SECURITY_AUTHORIZATION, false);<a name="line.2049"></a>
+<span class="sourceLineNo">2050</span>    this.userProvider = UserProvider.instantiate(conf);<a name="line.2050"></a>
+<span class="sourceLineNo">2051</span>    this.isSecurityEnabled = userProvider.isHBaseSecurityEnabled();<a name="line.2051"></a>
+<span class="sourceLineNo">2052</span>    if (isSecurityEnabled) {<a name="line.2052"></a>
+<span class="sourceLineNo">2053</span>      HBaseSaslRpcServer.init(conf);<a name="line.2053"></a>
+<span class="sourceLineNo">2054</span>    }<a name="line.2054"></a>
+<span class="sourceLineNo">2055</span>    initReconfigurable(conf);<a name="line.2055"></a>
 <span class="sourceLineNo">2056</span><a name="line.2056"></a>
-<span class="sourceLineNo">2057</span>  @Override<a name="line.2057"></a>
-<span class="sourceLineNo">2058</span>  public void onConfigurationChange(Configuration newConf) {<a name="line.2058"></a>
-<span class="sourceLineNo">2059</span>    initReconfigurable(newConf);<a name="line.2059"></a>
-<span class="sourceLineNo">2060</span>  }<a name="line.2060"></a>
-<span class="sourceLineNo">2061</span><a name="line.2061"></a>
-<span class="sourceLineNo">2062</span>  private void initReconfigurable(Configuration confToLoad) {<a name="line.2062"></a>
-<span class="sourceLineNo">2063</span>    this.allowFallbackToSimpleAuth = confToLoad.getBoolean(FALLBACK_TO_INSECURE_CLIENT_AUTH, false);<a name="line.2063"></a>
-<span class="sourceLineNo">2064</span>    if (isSecurityEnabled &amp;&amp; allowFallbackToSimpleAuth) {<a name="line.2064"></a>
-<span class="sourceLineNo">2065</span>      LOG.warn("********* WARNING! *********");<a name="line.2065"></a>
-<span class="sourceLineNo">2066</span>      LOG.warn("This server is configured to allow connections from INSECURE clients");<a name="line.2066"></a>
-<span class="sourceLineNo">2067</span>      LOG.warn("(" + FALLBACK_TO_INSECURE_CLIENT_AUTH + " = true).");<a name="line.2067"></a>
-<span class="sourceLineNo">2068</span>      LOG.warn("While this option is enabled, client identities cannot be secured, and user");<a name="line.2068"></a>
-<span class="sourceLineNo">2069</span>      LOG.warn("impersonation is possible!");<a name="line.2069"></a>
-<span class="sourceLineNo">2070</span>      LOG.warn("For secure operation, please disable SIMPLE authentication as soon as possible,");<a name="line.2070"></a>
-<span class="sourceLineNo">2071</span>      LOG.warn("by setting " + FALLBACK_TO_INSECURE_CLIENT_AUTH + " = false in hbase-site.xml");<a name="line.2071"></a>
-<span class="sourceLineNo">2072</span>      LOG.warn("****************************");<a name="line.2072"></a>
-<span class="sourceLineNo">2073</span>    }<a name="line.2073"></a>
-<span class="sourceLineNo">2074</span>  }<a name="line.2074"></a>
-<span class="sourceLineNo">2075</span><a name="line.2075"></a>
-<span class="sourceLineNo">2076</span>  /**<a name="line.2076"></a>
-<span class="sourceLineNo">2077</span>   * Subclasses of HBaseServer can override this to provide their own<a name="line.2077"></a>
-<span class="sourceLineNo">2078</span>   * Connection implementations.<a name="line.2078"></a>
-<span class="sourceLineNo">2079</span>   */<a name="line.2079"></a>
-<span class="sourceLineNo">2080</span>  protected Connection getConnection(SocketChannel channel, long time) {<a name="line.2080"></a>
-<span class="sourceLineNo">2081</span>    return new Connection(channel, time);<a name="line.2081"></a>
-<span class="sourceLineNo">2082</span>  }<a name="line.2082"></a>
-<span class="sourceLineNo">2083</span><a name="line.2083"></a>
-<span class="sourceLineNo">2084</span>  /**<a name="line.2084"></a>
-<span class="sourceLineNo">2085</span>   * Setup response for the RPC Call.<a name="line.2085"></a>
-<span class="sourceLineNo">2086</span>   *<a name="line.2086"></a>
-<span class="sourceLineNo">2087</span>   * @param response buffer to serialize the response into<a name="line.2087"></a>
-<span class="sourceLineNo">2088</span>   * @param call {@link Call} to which we are setting up the response<a name="line.2088"></a>
-<span class="sourceLineNo">2089</span>   * @param error error message, if the call failed<a name="line.2089"></a>
-<span class="sourceLineNo">2090</span>   * @throws IOException<a name="line.2090"></a>
-<span class="sourceLineNo">2091</span>   */<a name="line.2091"></a>
-<span class="sourceLineNo">2092</span>  private void setupResponse(ByteArrayOutputStream response, Call call, Throwable t, String error)<a name="line.2092"></a>
-<span class="sourceLineNo">2093</span>  throws IOException {<a name="line.2093"></a>
-<span class="sourceLineNo">2094</span>    if (response != null) response.reset();<a name="line.2094"></a>
-<span class="sourceLineNo">2095</span>    call.setResponse(null, null, t, error);<a name="line.2095"></a>
-<span class="sourceLineNo">2096</span>  }<a name="line.2096"></a>
-<span class="sourceLineNo">2097</span><a name="line.2097"></a>
-<span class="sourceLineNo">2098</span>  protected void closeConnection(Connection connection) {<a name="line.2098"></a>
-<span class="sourceLineNo">2099</span>    synchronized (connectionList) {<a name="line.2099"></a>
-<span class="sourceLineNo">2100</span>      if (connectionList.remove(connection)) {<a name="line.2100"></a>
-<span class="sourceLineNo">2101</span>        numConnections--;<a name="line.2101"></a>
-<span class="sourceLineNo">2102</span>      }<a name="line.2102"></a>
-<span class="sourceLineNo">2103</span>    }<a name="line.2103"></a>
-<span class="sourceLineNo">2104</span>    connection.close();<a name="line.2104"></a>
-<span class="sourceLineNo">2105</span>  }<a name="line.2105"></a>
-<span class="sourceLineNo">2106</span><a name="line.2106"></a>
-<span class="sourceLineNo">2107</span>  Configuration getConf() {<a name="line.2107"></a>
-<span class="sourceLineNo">2108</span>    return conf;<a name="line.2108"></a>
+<span class="sourceLineNo">2057</span>    this.scheduler = scheduler;<a name="line.2057"></a>
+<span class="sourceLineNo">2058</span>    this.scheduler.init(new RpcSchedulerContext(this));<a name="line.2058"></a>
+<span class="sourceLineNo">2059</span>  }<a name="line.2059"></a>
+<span class="sourceLineNo">2060</span><a name="line.2060"></a>
+<span class="sourceLineNo">2061</span>  @Override<a name="line.2061"></a>
+<span class="sourceLineNo">2062</span>  public void onConfigurationChange(Configuration newConf) {<a name="line.2062"></a>
+<span class="sourceLineNo">2063</span>    initReconfigurable(newConf);<a name="line.2063"></a>
+<span class="sourceLineNo">2064</span>  }<a name="line.2064"></a>
+<span class="sourceLineNo">2065</span><a name="line.2065"></a>
+<span class="sourceLineNo">2066</span>  private void initReconfigurable(Configuration confToLoad) {<a name="line.2066"></a>
+<span class="sourceLineNo">2067</span>    this.allowFallbackToSimpleAuth = confToLoad.getBoolean(FALLBACK_TO_INSECURE_CLIENT_AUTH, false);<a name="line.2067"></a>
+<span class="sourceLineNo">2068</span>    if (isSecurityEnabled &amp;&amp; allowFallbackToSimpleAuth) {<a name="line.2068"></a>
+<span class="sourceLineNo">2069</span>      LOG.warn("********* WARNING! *********");<a name="line.2069"></a>
+<span class="sourceLineNo">2070</span>      LOG.warn("This server is configured to allow connections from INSECURE clients");<a name="line.2070"></a>
+<span class="sourceLineNo">2071</span>      LOG.warn("(" + FALLBACK_TO_INSECURE_CLIENT_AUTH + " = true).");<a name="line.2071"></a>
+<span class="sourceLineNo">2072</span>      LOG.warn("While this option is enabled, client identities cannot be secured, and user");<a name="line.2072"></a>
+<span class="sourceLineNo">2073</span>      LOG.warn("impersonation is possible!");<a name="line.2073"></a>
+<span class="sourceLineNo">2074</span>      LOG.warn("For secure operation, please disable SIMPLE authentication as soon as possible,");<a name="line.2074"></a>
+<span class="sourceLineNo">2075</span>      LOG.warn("by setting " + FALLBACK_TO_INSECURE_CLIENT_AUTH + " = false in hbase-site.xml");<a name="line.2075"></a>
+<span class="sourceLineNo">2076</span>      LOG.warn("****************************");<a name="line.2076"></a>
+<span class="sourceLineNo">2077</span>    }<a name="line.2077"></a>
+<span class="sourceLineNo">2078</span>  }<a name="line.2078"></a>
+<span class="sourceLineNo">2079</span><a name="line.2079"></a>
+<span class="sourceLineNo">2080</span>  /**<a name="line.2080"></a>
+<span class="sourceLineNo">2081</span>   * Subclasses of HBaseServer can override this to provide their own<a name="line.2081"></a>
+<span class="sourceLineNo">2082</span>   * Connection implementations.<a name="line.2082"></a>
+<span class="sourceLineNo">2083</span>   */<a name="line.2083"></a>
+<span class="sourceLineNo">2084</span>  protected Connection getConnection(SocketChannel channel, long time) {<a name="line.2084"></a>
+<span class="sourceLineNo">2085</span>    return new Connection(channel, time);<a name="line.2085"></a>
+<span class="sourceLineNo">2086</span>  }<a name="line.2086"></a>
+<span class="sourceLineNo">2087</span><a name="line.2087"></a>
+<span class="sourceLineNo">2088</span>  /**<a name="line.2088"></a>
+<span class="sourceLineNo">2089</span>   * Setup response for the RPC Call.<a name="line.2089"></a>
+<span class="sourceLineNo">2090</span>   *<a name="line.2090"></a>
+<span class="sourceLineNo">2091</span>   * @param response buffer to serialize the response into<a name="line.2091"></a>
+<span class="sourceLineNo">2092</span>   * @param call {@link Call} to which we are setting up the response<a name="line.2092"></a>
+<span class="sourceLineNo">2093</span>   * @param error error message, if the call failed<a name="line.2093"></a>
+<span class="sourceLineNo">2094</span>   * @throws IOException<a name="line.2094"></a>
+<span class="sourceLineNo">2095</span>   */<a name="line.2095"></a>
+<span class="sourceLineNo">2096</span>  private void setupResponse(ByteArrayOutputStream response, Call call, Throwable t, String error)<a name="line.2096"></a>
+<span class="sourceLineNo">2097</span>  throws IOException {<a name="line.2097"></a>
+<span class="sourceLineNo">2098</span>    if (response != null) response.reset();<a name="line.2098"></a>
+<span class="sourceLineNo">2099</span>    call.setResponse(null, null, t, error);<a name="line.2099"></a>
+<span class="sourceLineNo">2100</span>  }<a name="line.2100"></a>
+<span class="sourceLineNo">2101</span><a name="line.2101"></a>
+<span class="sourceLineNo">2102</span>  protected void closeConnection(Connection connection) {<a name="line.2102"></a>
+<span class="sourceLineNo">2103</span>    synchronized (connectionList) {<a name="line.2103"></a>
+<span class="sourceLineNo">2104</span>      if (connectionList.remove(connection)) {<a name="line.2104"></a>
+<span class="sourceLineNo">2105</span>        numConnections--;<a name="line.2105"></a>
+<span class="sourceLineNo">2106</span>      }<a name="line.2106"></a>
+<span class="sourceLineNo">2107</span>    }<a name="line.2107"></a>
+<span class="sourceLineNo">2108</span>    connection.close();<a name="line.2108"></a>
 <span class="sourceLineNo">2109</span>  }<a name="line.2109"></a>
 <span class="sourceLineNo">2110</span><a name="line.2110"></a>
-<span class="sourceLineNo">2111</span>  /** Sets the socket buffer size used for responding to RPCs.<a name="line.2111"></a>
-<span class="sourceLineNo">2112</span>   * @param size send size<a name="line.2112"></a>
-<span class="sourceLineNo">2113</span>   */<a name="line.2113"></a>
-<span class="sourceLineNo">2114</span>  @Override<a name="line.2114"></a>
-<span class="sourceLineNo">2115</span>  public void setSocketSendBufSize(int size) { this.socketSendBufferSize = size; }<a name="line.2115"></a>
-<span class="sourceLineNo">2116</span><a name="line.2116"></a>
-<span class="sourceLineNo">2117</span>  @Override<a name="line.2117"></a>
-<span class="sourceLineNo">2118</span>  public boolean isStarted() {<a name="line.2118"></a>
-<span class="sourceLineNo">2119</span>    return this.started;<a name="line.2119"></a>
-<span class="sourceLineNo">2120</span>  }<a name="line.2120"></a>
-<span class="sourceLineNo">2121</span><a name="line.2121"></a>
-<span class="sourceLineNo">2122</span>  /** Starts the service.  Must be called before any calls will be handled. */<a name="line.2122"></a>
-<span class="sourceLineNo">2123</span>  @Override<a name="line.2123"></a>
-<span class="sourceLineNo">2124</span>  public synchronized void start() {<a name="line.2124"></a>
-<span class="sourceLineNo">2125</span>    if (started) return;<a name="line.2125"></a>
-<span class="sourceLineNo">2126</span>    authTokenSecretMgr = createSecretManager();<a name="line.2126"></a>
-<span class="sourceLineNo">2127</span>    if (authTokenSecretMgr != null) {<a name="line.2127"></a>
-<span class="sourceLineNo">2128</span>      setSecretManager(authTokenSecretMgr);<a name="line.2128"></a>
-<span class="sourceLineNo">2129</span>      authTokenSecretMgr.start();<a name="line.2129"></a>
-<span class="sourceLineNo">2130</span>    }<a name="line.2130"></a>
-<span class="sourceLineNo">2131</span>    this.authManager = new ServiceAuthorizationManager();<a name="line.2131"></a>
-<span class="sourceLineNo">2132</span>    HBasePolicyProvider.init(conf, authManager);<a name="line.2132"></a>
-<span class="sourceLineNo">2133</span>    responder.start();<a name="line.2133"></a>
-<span class="sourceLineNo">2134</span>    listener.start();<a name="line.2134"></a>
-<span class="sourceLineNo">2135</span>    scheduler.start();<a name="line.2135"></a>
-<span class="sourceLineNo">2136</span>    started = true;<a name="line.2136"></a>
-<span class="sourceLineNo">2137</span>  }<a name="line.2137"></a>
-<span class="sourceLineNo">2138</span><a name="line.2138"></a>
-<span class="sourceLineNo">2139</span>  @Override<a name="line.2139"></a>
-<span class="sourceLineNo">2140</span>  public void refreshAuthManager(PolicyProvider pp) {<a name="line.2140"></a>
-<span class="sourceLineNo">2141</span>    // Ignore warnings that this should be accessed in a static way instead of via an instance;<a name="line.2141"></a>
-<span class="sourceLineNo">2142</span>    // it'll break if you go via static route.<a name="line.2142"></a>
-<span class="sourceLineNo">2143</span>    this.authManager.refresh(this.conf, pp);<a name="line.2143"></a>
-<span class="sourceLineNo">2144</span>  }<a name="line.2144"></a>
-<span class="sourceLineNo">2145</span><a name="line.2145"></a>
-<span class="sourceLineNo">2146</span>  private AuthenticationTokenSecretManager createSecretManager() {<a name="line.2146"></a>
-<span class="sourceLineNo">2147</span>    if (!isSecurityEnabled) return null;<a name="line.2147"></a>
-<span class="sourceLineNo">2148</span>    if (server == null) return null;<a name="line.2148"></a>
-<span class="sourceLineNo">2149</span>    Configuration conf = server.getConfiguration();<a name="line.2149"></a>
-<span class="sourceLineNo">2150</span>    long keyUpdateInterval =<a name="line.2150"></a>
-<span class="sourceLineNo">2151</span>        conf.getLong("hbase.auth.key.update.interval", 24*60*60*1000);<a name="line.2151"></a>
-<span class="sourceLineNo">2152</span>    long maxAge =<a name="line.2152"></a>
-<span class="sourceLineNo">2153</span>        conf.getLong("hbase.auth.token.max.lifetime", 7*24*60*60*1000);<a name="line.2153"></a>
-<span class="sourceLineNo">2154</span>    return new AuthenticationTokenSecretManager(conf, server.getZooKeeper(),<a name="line.2154"></a>
-<span class="sourceLineNo">2155</span>        server.getServerName().toString(), keyUpdateInterval, maxAge);<a name="line.2155"></a>
-<span class="sourceLineNo">2156</span>  }<a name="line.2156"></a>
-<span class="sourceLineNo">2157</span><a name="line.2157"></a>
-<span class="sourceLineNo">2158</span>  public SecretManager&lt;? extends TokenIdentifier&gt; getSecretManager() {<a name="line.2158"></a>
-<span class="sourceLineNo">2159</span>    return this.secretManager;<a name="line.2159"></a>
+<span class="sourceLineNo">2111</span>  Configuration getConf() {<a name="line.2111"></a>
+<span class="sourceLineNo">2112</span>    return conf;<a name="line.2112"></a>
+<span class="sourceLineNo">2113</span>  }<a name="line.2113"></a>
+<span class="sourceLineNo">2114</span><a name="line.2114"></a>
+<span class="sourceLineNo">2115</span>  /** Sets the socket buffer size used for responding to RPCs.<a name="line.2115"></a>
+<span class="sourceLineNo">2116</span>   * @param size send size<a name="line.2116"></a>
+<span class="sourceLineNo">2117</span>   */<a name="line.2117"></a>
+<span class="sourceLineNo">2118</span>  @Override<a name="line.2118"></a>
+<span class="sourceLineNo">2119</span>  public void setSocketSendBufSize(int size) { this.socketSendBufferSize = size; }<a name="line.2119"></a>
+<span class="sourceLineNo">2120</span><a name="line.2120"></a>
+<span class="sourceLineNo">2121</span>  @Override<a name="line.2121"></a>
+<span class="sourceLineNo">2122</span>  public boolean isStarted() {<a name="line.2122"></a>
+<span class="sourceLineNo">2123</span>    return this.started;<a name="line.2123"></a>
+<span class="sourceLineNo">2124</span>  }<a name="line.2124"></a>
+<span class="sourceLineNo">2125</span><a name="line.2125"></a>
+<span class="sourceLineNo">2126</span>  /** Starts the service.  Must be called before any calls will be handled. */<a name="line.2126"></a>
+<span class="sourceLineNo">2127</span>  @Override<a name="line.2127"></a>
+<span class="sourceLineNo">2128</span>  public synchronized void start() {<a name="line.2128"></a>
+<span class="sourceLineNo">2129</span>    if (started) return;<a name="line.2129"></a>
+<span class="sourceLineNo">2130</span>    authTokenSecretMgr = createSecretManager();<a name="line.2130"></a>
+<span class="sourceLineNo">2131</span>    if (authTokenSecretMgr != null) {<a name="line.2131"></a>
+<span class="sourceLineNo">2132</span>      setSecretManager(authTokenSecretMgr);<a name="line.2132"></a>
+<span class="sourceLineNo">2133</span>      authTokenSecretMgr.start();<a name="line.2133"></a>
+<span class="sourceLineNo">2134</span>    }<a name="line.2134"></a>
+<span class="sourceLineNo">2135</span>    this.authManager = new ServiceAuthorizationManager();<a name="line.2135"></a>
+<span class="sourceLineNo">2136</span>    HBasePolicyProvider.init(conf, authManager);<a name="line.2136"></a>
+<span class="sourceLineNo">2137</span>    responder.start();<a name="line.2137"></a>
+<span class="sourceLineNo">2138</span>    listener.start();<a name="line.2138"></a>
+<span class="sourceLineNo">2139</span>    scheduler.start();<a name="line.2139"></a>
+<span class="sourceLineNo">2140</span>    started = true;<a name="line.2140"></a>
+<span class="sourceLineNo">2141</span>  }<a name="line.2141"></a>
+<span class="sourceLineNo">2142</span><a name="line.2142"></a>
+<span class="sourceLineNo">2143</span>  @Override<a name="line.2143"></a>
+<span class="sourceLineNo">2144</span>  public void refreshAuthManager(PolicyProvider pp) {<a name="line.2144"></a>
+<span class="sourceLineNo">2145</span>    // Ignore warnings that this should be accessed in a static way instead of via an instance;<a name="line.2145"></a>
+<span class="sourceLineNo">2146</span>    // it'll break if you go via static route.<a name="line.2146"></a>
+<span class="sourceLineNo">2147</span>    this.authManager.refresh(this.conf, pp);<a name="line.2147"></a>
+<span class="sourceLineNo">2148</span>  }<a name="line.2148"></a>
+<span class="sourceLineNo">2149</span><a name="line.2149"></a>
+<span class="sourceLineNo">2150</span>  private AuthenticationTokenSecretManager createSecretManager() {<a name="line.2150"></a>
+<span class="sourceLineNo">2151</span>    if (!isSecurityEnabled) return null;<a name="line.2151"></a>
+<span class="sourceLineNo">2152</span>    if (server == null) return null;<a name="line.2152"></a>
+<span class="sourceLineNo">2153</span>    Configuration conf = server.getConfiguration();<a name="line.2153"></a>
+<span class="sourceLineNo">2154</span>    long keyUpdateInterval =<a name="line.2154"></a>
+<span class="sourceLineNo">2155</span>        conf.getLong("hbase.auth.key.update.interval", 24*60*60*1000);<a name="line.2155"></a>
+<span class="sourceLineNo">2156</span>    long maxAge =<a name="line.2156"></a>
+<span class="sourceLineNo">2157</span>        conf.getLong("hbase.auth.token.max.lifetime", 7*24*60*60*1000);<a name="line.2157"></a>
+<span class="sourceLineNo">2158</span>    return new AuthenticationTokenSecretManager(conf, server.getZooKeeper(),<a name="line.2158"></a>
+<span class="sourceLineNo">2159</span>        server.getServerName().toString(), keyUpdateInterval, maxAge);<a name="line.2159"></a>
 <span class="sourceLineNo">2160</span>  }<a name="line.2160"></a>
 <span class="sourceLineNo">2161</span><a name="line.2161"></a>
-<span class="sourceLineNo">2162</span>  @SuppressWarnings("unchecked")<a name="line.2162"></a>
-<span class="sourceLineNo">2163</span>  public void setSecretManager(SecretManager&lt;? extends TokenIdentifier&gt; secretManager) {<a name="line.2163"></a>
-<span class="sourceLineNo">2164</span>    this.secretManager = (SecretManager&lt;TokenIdentifier&gt;) secretManager;<a name="line.2164"></a>
-<span class="sourceLineNo">2165</span>  }<a name="line.2165"></a>
-<span class="sourceLineNo">2166</span><a name="line.2166"></a>
-<span class="sourceLineNo">2167</span>  /**<a name="line.2167"></a>
-<span class="sourceLineNo">2168</span>   * This is a server side method, which is invoked over RPC. On success<a name="line.2168"></a>
-<span class="sourceLineNo">2169</span>   * the return response has protobuf response payload. On failure, the<a name="line.2169"></a>
-<span class="sourceLineNo">2170</span>   * exception name and the stack trace are returned in the protobuf response.<a name="line.2170"></a>
-<span class="sourceLineNo">2171</span>   */<a name="line.2171"></a>
-<span class="sourceLineNo">2172</span>  @Override<a name="line.2172"></a>
-<span class="sourceLineNo">2173</span>  public Pair&lt;Message, CellScanner&gt; call(BlockingService service, MethodDescriptor md,<a name="line.2173"></a>
-<span class="sourceLineNo">2174</span>      Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status)<a name="line.2174"></a>
-<span class="sourceLineNo">2175</span>  throws IOException {<a name="line.2175"></a>
-<span class="sourceLineNo">2176</span>    try {<a name="line.2176"></a>
-<span class="sourceLineNo">2177</span>      status.setRPC(md.getName(), new Object[]{param}, receiveTime);<a name="line.2177"></a>
-<span class="sourceLineNo">2178</span>      // TODO: Review after we add in encoded data blocks.<a name="line.2178"></a>
-<span class="sourceLineNo">2179</span>      status.setRPCPacket(param);<a name="line.2179"></a>
-<span class="sourceLineNo">2180</span>      status.resume("Servicing call");<a name="line.2180"></a>
-<span class="sourceLineNo">2181</span>      //get an instance of the method arg type<a name="line.2181"></a>
-<span class="sourceLineNo">2182</span>      long startTime = System.currentTimeMillis();<a name="line.2182"></a>
-<span class="sourceLineNo">2183</span>      PayloadCarryingRpcController controller = new PayloadCarryingRpcController(cellScanner);<a name="line.2183"></a>
-<span class="sourceLineNo">2184</span>      Message result = service.callBlockingMethod(md, controller, param);<a name="line.2184"></a>
-<span class="sourceLineNo">2185</span>      long endTime = System.currentTimeMillis();<a name="line.2185"></a>
-<span class="sourceLineNo">2186</span>      int processingTime = (int) (endTime - startTime);<a name="line.2186"></a>
-<span class="sourceLineNo">2187</span>      int qTime = (int) (startTime - receiveTime);<a name="line.2187"></a>
-<span class="sourceLineNo">2188</span>      int totalTime = (int) (endTime - receiveTime);<a name="line.2188"></a>
-<span class="sourceLineNo">2189</span>      if (LOG.isTraceEnabled()) {<a name="line.2189"></a>
-<span class="sourceLineNo">2190</span>        LOG.trace(CurCall.get().toString() +<a name="line.2190"></a>
-<span class="sourceLineNo">2191</span>            ", response " + TextFormat.shortDebugString(result) +<a name="line.2191"></a>
-<span class="sourceLineNo">2192</span>            " queueTime: " + qTime +<a name="line.2192"></a>
-<span class="sourceLineNo">2193</span>            " processingTime: " + processingTime +<a name="line.2193"></a>
-<span class="sourceLineNo">2194</span>            " totalTime: " + totalTime);<a name="line.2194"></a>
-<span class="sourceLineNo">2195</span>      }<a name="line.2195"></a>
-<span class="sourceLineNo">2196</span>      long requestSize = param.getSerializedSize();<a name="line.2196"></a>
-<span class="sourceLineNo">2197</span>      long responseSize = result.getSerializedSize();<a name="line.2197"></a>
-<span class="sourceLineNo">2198</span>      metrics.dequeuedCall(qTime);<a name="line.2198"></a>
-<span class="sourceLineNo">2199</span>      metrics.processedCall(processingTime);<a name="line.2199"></a>
-<span class="sourceLineNo">2200</span>      metrics.totalCall(totalTime);<a name="line.2200"></a>
-<span class="sourceLineNo">2201</span>      metrics.receivedRequest(requestSize);<a name="line.2201"></a>
-<span class="sourceLineNo">2202</span>      metrics.sentResponse(responseSize);<a name="line.2202"></a>
-<span class="sourceLineNo">2203</span>      // log any RPC responses that are slower than the configured warn<a name="line.2203"></a>
-<span class="sourceLineNo">2204</span>      // response time or larger than configured warning size<a name="line.2204"></a>
-<span class="sourceLineNo">2205</span>      boolean tooSlow = (processingTime &gt; warnResponseTime &amp;&amp; warnResponseTime &gt; -1);<a name="line.2205"></a>
-<span class="sourceLineNo">2206</span>      boolean tooLarge = (responseSize &gt; warnResponseSize &amp;&amp; warnResponseSize &gt; -1);<a name="line.2206"></a>
-<span class="sourceLineNo">2207</span>      if (tooSlow || tooLarge) {<a name="line.2207"></a>
-<span class="sourceLineNo">2208</span>        // when tagging, we let TooLarge trump TooSmall to keep output simple<a name="line.2208"></a>
-<span class="sourceLineNo">2209</span>        // note that large responses will often also be slow.<a name="line.2209"></a>
-<span class="sourceLineNo">2210</span>        logResponse(new Object[]{param},<a name="line.2210"></a>
-<span class="sourceLineNo">2211</span>            md.getName(), md.getName() + "(" + param.getClass().getName() + ")",<a name="line.2211"></a>
-<span class="sourceLineNo">2212</span>            (tooLarge ? "TooLarge" : "TooSlow"),<a name="line.2212"></a>
-<span class="sourceLineNo">2213</span>            status.getClient(), startTime, processingTime, qTime,<a name="line.2213"></a>
-<span class="sourceLineNo">2214</span>            responseSize);<a name="line.2214"></a>
-<span class="sourceLineNo">2215</span>      }<a name="line.2215"></a>
-<span class="sourceLineNo">2216</span>      return new Pair&lt;Message, CellScanner&gt;(result, controller.cellScanner());<a name="line.2216"></a>
-<span class="sourceLineNo">2217</span>    } catch (Throwable e) {<a name="line.2217"></a>
-<span class="sourceLineNo">2218</span>      // The above callBlockingMethod will always return a SE.  Strip the SE wrapper before<a name="line.2218"></a>
-<span class="sourceLineNo">2219</span>      // putting it on the wire.  Its needed to adhere to the pb Service Interface but we don't<a name="line.2219"></a>
-<span class="sourceLineNo">2220</span>      // need to pass it over the wire.<a name="line.2220"></a>
-<span class="sourceLineNo">2221</span>      if (e instanceof ServiceException) e = e.getCause();<a name="line.2221"></a>
-<span class="sourceLineNo">2222</span><a name="line.2222"></a>
-<span class="sourceLineNo">2223</span>      // increment the number of requests that were exceptions.<a name="line.2223"></a>
-<span class="sourceLineNo">2224</span>      metrics.exception(e);<a name="line.2224"></a>
-<span class="sourceLineNo">2225</span><a name="line.2225"></a>
-<span class="sourceLineNo">2226</span>      if (e instanceof LinkageError) throw new DoNotRetryIOException(e);<a name="line.2226"></a>
-<span class="sourceLineNo">2227</span>      if (e instanceof IOException) throw (IOException)e;<a name="line.2227"></a>
-<span class="sourceLineNo">2228</span>      LOG.error("Unexpected throwable object ", e);<a name="line.2228"></a>
-<span class="sourceLineNo">2229</span>      throw new IOException(e.getMessage(), e);<a name="line.2229"></a>
-<span class="sourceLineNo">2230</span>    }<a name="line.2230"></a>
-<span class="sourceLineNo">2231</span>  }<a name="line.2231"></a>
-<span class="sourceLineNo">2232</span><a name="line.2232"></a>
-<span class="sourceLineNo">2233</span>  /**<a name="line.2233"></a>
-<span class="sourceLineNo">2234</span>   * Logs an RPC response to the LOG file, producing valid JSON objects for<a name="line.2234"></a>
-<span class="sourceLineNo">2235</span>   * client Operations.<a name="line.2235"></a>
-<span class="sourceLineNo">2236</span>   * @param params The parameters received in the call.<a name="line.2236"></a>
-<span class="sourceLineNo">2237</span>   * @param methodName The name of the method invoked<a name="line.2237"></a>
-<span class="sourceLineNo">2238</span>   * @param call The string representation of the call<a name="line.2238"></a>
-<span class="sourceLineNo">2239</span>   * @param tag  The tag that will be used to indicate this event in the log.<a name="line.2239"></a>
-<span class="sourceLineNo">2240</span>   * @param clientAddress   The address of the client who made this call.<a name="line.2240"></a>
-<span class="sourceLineNo">2241</span>   * @param startTime       The time that the call was initiated, in ms.<a name="line.2241"></a>
-<span class="sourceLineNo">2242</span>   * @param processingTime  The duration that the call took to run, in ms.<a name="line.2242"></a>
-<span class="sourceLineNo">2243</span>   * @param qTime           The duration that the call spent on the queue<a name="line.2243"></a>
-<span class="sourceLineNo">2244</span>   *                        prior to being initiated, in ms.<a name="line.2244"></a>
-<span class="sourceLineNo">2245</span>   * @param responseSize    The size in bytes of the response buffer.<a name="line.2245"></a>
-<span class="sourceLineNo">2246</span>   */<a name="line.2246"></a>
-<span class="sourceLineNo">2247</span>  void logResponse(Object[] params, String methodName, String call, String tag,<a name="line.2247"></a>
-<span class="sourceLineNo">2248</span>      String clientAddress, long startTime, int processingTime, int qTime,<a name="line.2248"></a>
-<span class="sourceLineNo">2249</span>      long responseSize)<a name="line.2249"></a>
-<span class="sourceLineNo">2250</span>          throws IOException {<a name="line.2250"></a>
-<span class="sourceLineNo">2251</span>    // base information that is reported regardless of type of call<a name="line.2251"></a>
-<span class="sourceLineNo">2252</span>    Map&lt;String, Object&gt; responseInfo = new HashMap&lt;String, Object&gt;();<a name="line.2252"></a>
-<span class="sourceLineNo">2253</span>    responseInfo.put("starttimems", startTime);<a name="line.2253"></a>
-<span class="sourceLineNo">2254</span>    responseInfo.put("processingtimems", processingTime);<a name="line.2254"></a>
-<span class="sourceLineNo">2255</span>    responseInfo.put("queuetimems", qTime);<a name="line.2255"></a>
-<span class="sourceLineNo">2256</span>    responseInfo.put("responsesize", responseSize);<a name="line.2256"></a>
-<span class="sourceLineNo">2257</span>    responseInfo.put("client", clientAddress);<a name="line.2257"></a>
-<span class="sourceLineNo">2258</span>    responseInfo.put("class", server == null? "": server.getClass().getSimpleName());<a name="line.2258"></a>
-<span class="sourceLineNo">2259</span>    responseInfo.put("method", methodName);<a name="line.2259"></a>
-<span class="sourceLineNo">2260</span>    if (params.length == 2 &amp;&amp; server instanceof HRegionServer &amp;&amp;<a name="line.2260"></a>
-<span class="sourceLineNo">2261</span>        params[0] instanceof byte[] &amp;&amp;<a name="line.2261"></a>
-<span class="sourceLineNo">2262</span>        params[1] instanceof Operation) {<a name="line.2262"></a>
-<span class="sourceLineNo">2263</span>      // if the slow process is a query, we want to log its table as well<a name="line.2263"></a>
-<span class="sourceLineNo">2264</span>      // as its own fingerprint<a name="line.2264"></a>
-<span class="sourceLineNo">2265</span>      TableName tableName = TableName.valueOf(<a name="line.2265"></a>
-<span class="sourceLineNo">2266</span>          HRegionInfo.parseRegionName((byte[]) params[0])[0]);<a name="line.2266"></a>
-<span class="sourceLineNo">2267</span>      responseInfo.put("table", tableName.getNameAsString());<a name="line.2267"></a>
-<span class="sourceLineNo">2268</span>      // annotate the response map with operation details<a name="line.2268"></a>
-<span class="sourceLineNo">2269</span>      responseInfo.putAll(((Operation) params[1]).toMap());<a name="line.2269"></a>
-<span class="sourceLineNo">2270</span>      // report to the log file<a name="line.2270"></a>
-<span class="sourceLineNo">2271</span>      LOG.warn("(operation" + tag + "): " +<a name="line.2271"></a>
-<span class="sourceLineNo">2272</span>               MAPPER.writeValueAsString(responseInfo));<a name="line.2272"></a>
-<span class="sourceLineNo">2273</span>    } else if (params.length == 1 &amp;&amp; server instanceof HRegionServer &amp;&amp;<a name="line.2273"></a>
-<span class="sourceLineNo">2274</span>        params[0] instanceof Operation) {<a name="line.2274"></a>
-<span class="sourceLineNo">2275</span>      // annotate the response map with operation details<a name="line.2275"></a>
-<span class="sourceLineNo">2276</span>      responseInfo.putAll(((Operation) params[0]).toMap());<a name="line.2276"></a>
-<span class="sourceLineNo">2277</span>      // report to the log file<a name="line.2277"></a>
-<span class="sourceLineNo">2278</span>      LOG.warn("(operation" + tag + "): " +<a name="line.2278"></a>
-<span class="sourceLineNo">2279</span>               MAPPER.writeValueAsString(responseInfo));<a name="line.2279"></a>
-<span class="sourceLineNo">2280</span>    } else {<a name="line.2280"></a>
-<span class="sourceLineNo">2281</span>      // can't get JSON details, so just report call.toString() along with<a name="line.2281"></a>
-<span class="sourceLineNo">2282</span>      // a more generic tag.<a name="line.2282"></a>
-<span class="sourceLineNo">2283</span>      responseInfo.put("call", call);<a name="line.2283"></a>
-<span class="sourceLineNo">2284</span>      LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo));<a name="line.2284"></a>
-<span class="sourceLineNo">2285</span>    }<a name="line.2285"></a>
-<span class="sourceLineNo">2286</span>  }<a name="line.2286"></a>
-<span class="sourceLineNo">2287</span><a name="line.2287"></a>
-<span class="sourceLineNo">2288</span>  /** Stops the service.  No new calls will be handled after this is called. */<a name="line.2288"></a>
-<span class="sourceLineNo">2289</span>  @Override<a name="line.2289"></a>
-<span class="sourceLineNo">2290</span>  public synchronized void stop() {<a name="line.2290"></a>
-<span class="sourceLineNo">2291</span>    LOG.info("Stopping server on " + port);<a name="line.2291"></a>
-<span class="sourceLineNo">2292</span>    running = false;<a name="line.2292"></a>
-<span class="sourceLineNo">2293</span>    if (authTokenSecretMgr != null) {<a name="line.2293"></a>
-<span class="sourceLineNo">2294</span>      authTokenSecretMgr.stop();<a name="line.2294"></a>
-<span class="sourceLineNo">2295</span>      authTokenSecretMgr = null;<a name="line.2295"></a>
-<span class="sourceLineNo">2296</span>    }<a name="line.2296"></a>
-<span class="sourceLineNo">2297</span>    listener.interrupt();<a name="line.2297"></a>
-<span class="sourceLineNo">2298</span>    listener.doStop();<a name="line.2298"></a>
-<span class="sourceLineNo">2299</span>    responder.interrupt();<a name="line.2299"></a>
-<span class="sourceLineNo">2300</span>    scheduler.stop();<a name="line.2300"></a>
-<span class="sourceLineNo">2301</span>    notifyAll();<a name="line.2301"></a>
-<span class="sourceLineNo">2302</span>  }<a name="line.2302"></a>
-<span class="sourceLineNo">2303</span><a name="line.2303"></a>
-<span class="sourceLineNo">2304</span>  /** Wait for the server to be stopped.<a name="line.2304"></a>
-<span class="sourceLineNo">2305</span>   * Does not wait for all subthreads to finish.<a name="line.2305"></a>
-<span class="sourceLineNo">2306</span>   *  See {@link #stop()}.<a name="line.2306"></a>
-<span class="sourceLineNo">2307</span>   * @throws InterruptedException e<a name="line.2307"></a>
-<span class="sourceLineNo">2308</span>   */<a name="line.2308"></a>
-<span class="sourceLineNo">2309</span>  @Override<a name="line.2309"></a>
-<span class="sourceLineNo">2310</span>  public synchronized void join() throws InterruptedException {<a name="line.2310"></a>
-<span class="sourceLineNo">2311</span>    while (running) {<a name="line.2311"></a>
-<span class="sourceLineNo">2312</span>      wait();<a name="line.2312"></a>
-<span class="sourceLineNo">2313</span>    }<a name="line.2313"></a>
-<span class="sourceLineNo">2314</span>  }<a name="line.2314"></a>
-<span class="sourceLineNo">2315</span><a name="line.2315"></a>
-<span class="sourceLineNo">2316</span>  /**<a name="line.2316"></a>
-<span class="sourceLineNo">2317</span>   * Return the socket (ip+port) on which the RPC server is listening to. May return null if<a name="line.2317"></a>
-<span class="sourceLineNo">2318</span>   * the listener channel is closed.<a name="line.2318"></a>
-<span class="sourceLineNo">2319</span>   * @return the socket (ip+port) on which the RPC server is listening to, or null if this<a name="line.2319"></a>
-<span class="sourceLineNo">2320</span>   * information cannot be determined<a name="line.2320"></a>
-<span class="sourceLineNo">2321</span>   */<a name="line.2321"></a>
-<span class="sourceLineNo">2322</span>  @Override<a name="line.2322"></a>
-<span class="sourceLineNo">2323</span>  public synchronized InetSocketAddress getListenerAddress() {<a name="line.2323"></a>
-<span class="sourceLineNo">2324</span>    if (listener == null) {<a name="line.2324"></a>
-<span class="sourceLineNo">2325</span>      return null;<a name="line.2325"></a>
-<span class="sourceLineNo">2326</span>    }<a name="line.2326"></a>
-<span class="sourceLineNo">2327</span>    return listener.getAddress();<a name="line.2327"></a>
-<span class="sourceLineNo">2328</span>  }<a name="line.2328"></a>
-<span class="sourceLineNo">2329</span><a name="line.2329"></a>
-<span class="sourceLineNo">2330</span>  /**<a name="line.2330"></a>
-<span class="sourceLineNo">2331</span>   * Set the handler for calling out of RPC for error conditions.<a name="line.2331"></a>
-<span class="sourceLineNo">2332</span>   * @param handler the handler implementation<a name="line.2332"></a>
-<span class="sourceLineNo">2333</span>   */<a name="line.2333"></a>
-<span class="sourceLineNo">2334</span>  @Override<a name="line.2334"></a>
-<span class="sourceLineNo">2335</span>  public void setErrorHandler(HBaseRPCErrorHandler handler) {<a name="line.2335"></a>
-<span class="sourceLineNo">2336</span>    this.errorHandler = handler;<a name="line.2336"></a>
-<span class="sourceLineNo">2337</span>  }<a name="line.2337"></a>
-<span class="sourceLineNo">2338</span><a name="line.2338"></a>
-<span class="sourceLineNo">2339</span>  @Override<a name="line.2339"></a>
-<span class="sourceLineNo">2340</span>  public HBaseRPCErrorHandler getErrorHandler() {<a name="line.2340"></a>
-<span class="sourceLineNo">2341</span>    return this.errorHandler;<a name="line.2341"></a>
-<span class="sourceLineNo">2342</span>  }<a name="line.2342"></a>
-<span class="sourceLineNo">2343</span><a name="line.2343"></a>
-<span class="sourceLineNo">2344</span>  /**<a name="line.2344"></a>
-<span class="sourceLineNo">2345</span>   * Returns the metrics instance for reporting RPC call statistics<a name="line.2345"></a>
-<span class="sourceLineNo">2346</span>   */<a name="line.2346"></a>
-<span class="sourceLineNo">2347</span>  @Override<a name="line.2347"></a>
-<span class="sourceLineNo">2348</span>  public MetricsHBaseServer getMetrics() {<a name="line.2348"></a>
-<span class="sourceLineNo">2349</span>    return metrics;<a name="line.2349"></a>
-<span class="sourceLineNo">2350</span>  }<a name="line.2350"></a>
-<span class="sourceLineNo">2351</span><a name="line.2351"></a>
-<span class="sourceLineNo">2352</span>  @Override<a name="line.2352"></a>
-<span class="sourceLineNo">2353</span>  public void addCallSize(final long diff) {<a name="line.2353"></a>
-<span class="sourceLineNo">2354</span>    this.callQueueSize.add(diff);<a name="line.2354"></a>
-<span class="sourceLineNo">2355</span>  }<a name="line.2355"></a>
-<span class="sourceLineNo">2356</span><a name="line.2356"></a>
-<span class="sourceLineNo">2357</span>  /**<a name="line.2357"></a>
-<span class="sourceLineNo">2358</span>   * Authorize the incoming client connection.<a name="line.2358"></a>
-<span class="sourceLineNo">2359</span>   *<a name="line.2359"></a>
-<span class="sourceLineNo">2360</span>   * @param user client user<a name="line.2360"></a>
-<span class="sourceLineNo">2361</span>   * @param connection incoming connection<a name="line.2361"></a>
-<span class="sourceLineNo">2362</span>   * @param addr InetAddress of incoming connection<a name="line.2362"></a>
-<span class="sourceLineNo">2363</span>   * @throws org.apache.hadoop.security.authorize.AuthorizationException<a name="line.2363"></a>
-<span class="sourceLineNo">2364</span>   *         when the client isn't authorized to talk the protocol<a name="line.2364"></a>
-<span class="sourceLineNo">2365</span>   */<a name="line.2365"></a>
-<span class="sourceLineNo">2366</span>  public void authorize(UserGroupInformation user, ConnectionHeader connection, InetAddress addr)<a name="line.2366"></a>
-<span class="sourceLineNo">2367</span>  throws AuthorizationException {<a name="line.2367"></a>
-<span class="sourceLineNo">2368</span>    if (authorize) {<a name="line.2368"></a>
-<span class="sourceLineNo">2369</span>      Class&lt;?&gt; c = getServiceInterface(services, connection.getServiceName());<a name="line.2369"></a>
-<span class="sourceLineNo">2370</span>      this.authManager.authorize(user != null ? user : null, c, getConf(), addr);<a name="line.2370"></a>
-<span class="sourceLineNo">2371</span>    }<a name="line.2371"></a>
-<span class="sourceLineNo">2372</span>  }<a name="line.2372"></a>
-<span class="sourceLineNo">2373</span><a name="line.2373"></a>
-<span class="sourceLineNo">2374</span>  /**<a name="line.2374"></a>
-<span class="sourceLineNo">2375</span>   * When the read or write buffer size is larger than this limit, i/o will be<a name="line.2375"></a>
-<span class="sourceLineNo">2376</span>   * done in chunks of this size. Most RPC requests and responses would be<a name="line.2376"></a>
-<span class="sourceLineNo">2377</span>   * be smaller.<a name="line.2377"></a>
-<span class="sourceLineNo">2378</span>   */<a name="line.2378"></a>
-<span class="sourceLineNo">2379</span>  private static int NIO_BUFFER_LIMIT = 64 * 1024; //should not be more than 64KB.<a name="line.2379"></a>
-<span class="sourceLineNo">2380</span><a name="line.2380"></a>
-<span class="sourceLineNo">2381</span>  /**<a name="line.2381"></a>
-<span class="sourceLineNo">2382</span>   * This is a wrapper around {@link java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer)}.<a name="line.2382"></a>
-<span class="sourceLineNo">2383</span>   * If the amount of data is large, it writes to channel in smaller chunks.<a name="line.2383"></a>
-<span class="sourceLineNo">2384</span>   * This is to avoid jdk from creating many direct buffers as the size of<a name="line.2384"></a>
-<span class="sourceLineNo">2385</span>   * buffer increases. This also minimizes extra copies in NIO layer<a name="line.2385"></a>
-<span class="sourceLineNo">2386</span>   * as a result of multiple write operations required to write a large<a name="line.2386"></a>
-<span class="sourceLineNo">2387</span>   * buffer.<a name="line.2387"></a>
-<span class="sourceLineNo">2388</span>   *<a name="line.2388"></a>
-<span class="sourceLineNo">2389</span>   * @param channel writable byte channel to write to<a name="line.2389"></a>
-<span class="sourceLineNo">2390</span>   * @param bufferChain Chain of buffers to write<a name="line.2390"></a>
-<span class="sourceLineNo">2391</span>   * @return number of bytes written<a name="line.2391"></a>
-<span class="sourceLineNo">2392</span>   * @throws java.io.IOException e<a name="line.2392"></a>
-<span class="sourceLineNo">2393</span>   * @see java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer)<a name="line.2393"></a>
-<span class="sourceLineNo">2394</span>   */<a name="line.2394"></a>
-<span class="sourceLineNo">2395</span>  protected long channelWrite(GatheringByteChannel channel, BufferChain bufferChain)<a name="line.2395"></a>
-<span class="sourceLineNo">2396</span>  throws IOException {<a name="line.2396"></a>
-<span class="sourceLineNo">2397</span>    long count =  bufferChain.write(channel, NIO_BUFFER_LIMIT);<a name="line.2397"></a>
-<span class="sourceLineNo">2398</span>    if (count &gt; 0) this.metrics.sentBytes(count);<a name="line.2398"></a>
-<span class="sourceLineNo">2399</span>    return count;<a name="line.2399"></a>
-<span class="sourceLineNo">2400</span>  }<a name="line.2400"></a>
-<span class="sourceLineNo">2401</span><a name="line.2401"></a>
-<span class="sourceLineNo">2402</span>  /**<a name="line.2402"></a>
-<span class="sourceLineNo">2403</span>   * This is a wrapper around {@link java.nio.channels.ReadableByteChannel#read(java.nio.ByteBuffer)}.<a name="line.2403"></a>
-<span class="sourceLineNo">2404</span>   * If the amount of data is large, it writes to channel in smaller chunks.<a name="line.2404"></a>
-<span class="sourceLineNo">2405</span>   * This is to avoid jdk from creating many direct buffers as the size of<a name="line.2405"></a>
-<span class="sourceLineNo">2406</span>   * ByteBuffer increases. There should not be any performance degredation.<a name="line.2406"></a>
-<span class="sourceLineNo">2407</span>   *<a name="line.2407"></a>
-<span class="sourceLineNo">2408</span>   * @param channel writable byte channel to write on<a name="line.2408"></a>
-<span class="sourceLineNo">2409</span>   * @param buffer buffer to write<a name="line.2409"></a>
-<span class="sourceLineNo">2410</span>   * @return number of bytes written<a name="line.2410"></a>
-<span class="sourceLineNo">2411</span>   * @throws java.io.IOException e<a name="line.2411"></a>
-<span class="sourceLineNo">2412</span>   * @see java.nio.channels.ReadableByteChannel#read(java.nio.ByteBuffer)<a name="line.2412"></a>
-<span class="sourceLineNo">2413</span>   */<a name="line.2413"></a>
-<span class="sourceLineNo">2414</span>  protected int channelRead(ReadableByteChannel channel,<a name="line.2414"></a>
-<span class="sourceLineNo">2415</span>                                   ByteBuffer buffer) throws IOException {<a name="line.2415"></a>
-<span class="sourceLineNo">2416</span><a name="line.2416"></a>
-<span class="sourceLineNo">2417</span>    int count = (buffer.remaining() &lt;= NIO_BUFFER_LIMIT) ?<a name="line.2417"></a>
-<span class="sourceLineNo">2418</span>           channel.read(buffer) : channelIO(channel, null, buffer);<a name="line.2418"></a>
-<span class="sourceLineNo">2419</span>    if (count &gt; 0) {<a name="line.2419"></a>
-<span class="sourceLineNo">2420</span>      metrics.receivedBytes(count);<a name="line.2420"></a>
-<span class="sourceLineNo">2421</span>    }<a name="line.2421"></a>
-<span class="sourceLineNo">2422</span>    return count;<a name="line.2422"></a>
-<span class="sourceLineNo">2423</span>  }<a name="line.2423"></a>
-<span class="sourceLineNo">2424</span><a name="line.2424"></a>
-<span class="sourceLineNo">2425</span>  /**<a name="line.2425"></a>
-<span class="sourceLineNo">2426</span>   * Helper for {@link #channelRead(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer)}<a name="line.2426"></a>
-<span class="sourceLineNo">2427</span>   * and {@link #channelWrite(GatheringByteChannel, BufferChain)}. Only<a name="line.2427"></a>
-<span class="sourceLineNo">2428</span>   * one of readCh or writeCh should be non-null.<a name="line.2428"></a>
-<span class="sourceLineNo">2429</span>   *<a name="line.2429"></a>
-<span class="sourceLineNo">2430</span>   * @param readCh read channel<a name="line.2430"></a>
-<span class="sourceLineNo">2431</span>   * @param writeCh write channel<a name="line.2431"></a>
-<span class="sourceLineNo">2432</span>   * @param buf buffer to read or write into/out of<a name="line.2432"></a>
-<span class="sourceLineNo">2433</span>   * @return bytes written<a name="line.2433"></a>
-<span class="sourceLineNo">2434</span>   * @throws java.io.IOException e<a name="line.2434"></a>
-<span class="sourceLineNo">2435</span>   * @see #channelRead(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer)<a name="line.2435"></a>
-<span class="sourceLineNo">2436</span>   * @see #channelWrite(GatheringByteChannel, BufferChain)<a name="line.2436"></a>
-<span class="sourceLineNo">2437</span>   */<a name="line.2437"></a>
-<span class="sourceLineNo">2438</span>  private static int channelIO(ReadableByteChannel readCh,<a name="line.2438"></a>
-<span class="sourceLineNo">2439</span>                               WritableByteChannel writeCh,<a name="line.2439"></a>
-<span class="sourceLineNo">2440</span>                               ByteBuffer buf) throws IOException {<a name="line.2440"></a>
-<span class="sourceLineNo">2441</span><a name="line.2441"></a>
-<span class="sourceLineNo">2442</span>    int originalLimit = buf.limit();<a name="line.2442"></a>
-<span class="sourceLineNo">2443</span>    int initialRemaining = buf.remaining();<a name="line.2443"></a>
-<span class="sourceLineNo">2444</span>    int ret = 0;<a name="line.2444"></a>
+<span class="sourceLineNo">2162</span>  public SecretManager&lt;? extends TokenIdentifier&gt; getSecretManager() {<a name="line.2162"></a>
+<span class="sourceLineNo">2163</span>    return this.secretManager;<a name="line.2163"></a>
+<span class="sourceLineNo">2164</span>  }<a name="line.2164"></a>
+<span class="sourceLineNo">2165</span><a name="line.2165"></a>
+<span class="sourceLineNo">2166</span>  @SuppressWarnings("unchecked")<a name="line.2166"></a>
+<span class="sourceLineNo">2167</span>  public void setSecretManager(SecretManager&lt;? extends TokenIdentifier&gt; secretManager) {<a name="line.2167"></a>
+<span class="sourceLineNo">2168</span>    this.secretManager = (SecretManager&lt;TokenIdentifier&gt;) secretManager;<a name="line.2168"></a>
+<span class="sourceLineNo">2169</span>  }<a name="line.2169"></a>
+<span class="sourceLineNo">2170</span><a name="line.2170"></a>
+<span class="sourceLineNo">2171</span>  /**<a name="line.2171"></a>
+<span class="sourceLineNo">2172</span>   * This is a server side method, which is invoked over RPC. On success<a name="line.2172"></a>
+<span class="sourceLineNo">2173</span>   * the return response has protobuf response payload. On failure, the<a name="line.2173"></a>
+<span class="sourceLineNo">2174</span>   * exception name and the stack trace are returned in the protobuf response.<a name="line.2174"></a>
+<span class="sourceLineNo">2175</span>   */<a name="line.2175"></a>
+<span class="sourceLineNo">2176</span>  @Override<a name="line.2176"></a>
+<span class="sourceLineNo">2177</span>  public Pair&lt;Message, CellScanner&gt; call(BlockingService service, MethodDescriptor md,<a name="line.2177"></a>
+<span class="sourceLineNo">2178</span>      Message param, CellScanner cellScanner, long receiveTime, MonitoredRPCHandler status)<a name="line.2178"></a>
+<span class="sourceLineNo">2179</span>  throws IOException {<a name="line.2179"></a>
+<span class="sourceLineNo">2180</span>    try {<a name="line.2180"></a>
+<span class="sourceLineNo">2181</span>      status.setRPC(md.getName(), new Object[]{param}, receiveTime);<a name="line.2181"></a>
+<span class="sourceLineNo">2182</span>      // TODO: Review after we add in encoded data blocks.<a name="line.2182"></a>
+<span class="sourceLineNo">2183</span>      status.setRPCPacket(param);<a name="line.2183"></a>
+<span class="sourceLineNo">2184</span>      status.resume("Servicing call");<a name="line.2184"></a>
+<span class="sourceLineNo">2185</span>      //get an instance of the method arg type<a name="line.2185"></a>
+<span class="sourceLineNo">2186</span>      long startTime = System.currentTimeMillis();<a name="line.2186"></a>
+<span class="sourceLineNo">2187</span>      PayloadCarryingRpcController controller = new PayloadCarryingRpcController(cellScanner);<a name="line.2187"></a>
+<span class="sourceLineNo">2188</span>      Message result = service.callBlockingMethod(md, controller, param);<a name="line.2188"></a>
+<span class="sourceLineNo">2189</span>      long endTime = System.currentTimeMillis();<a name="line.2189"></a>
+<span class="sourceLineNo">2190</span>      int processingTime = (int) (endTime - startTime);<a name="line.2190"></a>
+<span class="sourceLineNo">2191</span>      int qTime = (int) (startTime - receiveTime);<a name="line.2191"></a>
+<span class="sourceLineNo">2192</span>      int totalTime = (int) (endTime - receiveTime);<a name="line.2192"></a>
+<span class="sourceLineNo">2193</span>      if (LOG.isTraceEnabled()) {<a name="line.2193"></a>
+<span class="sourceLineNo">2194</span>        LOG.trace(CurCall.get().toString() +<a name="line.2194"></a>
+<span class="sourceLineNo">2195</span>            ", response " + TextFormat.shortDebugString(result) +<a name="line.2195"></a>
+<span class="sourceLineNo">2196</span>            " queueTime: " + qTime +<a name="line.2196"></a>
+<span class="sourceLineNo">2197</span>            " processingTime: " + processingTime +<a name="line.2197"></a>
+<span class="sourceLineNo">2198</span>            " totalTime: " + totalTime);<a name="line.2198"></a>
+<span class="sourceLineNo">2199</span>      }<a name="line.2199"></a>
+<span class="sourceLineNo">2200</span>      long requestSize = param.getSerializedSize();<a name="line.2200"></a>
+<span class="sourceLineNo">2201</span>      long responseSize = result.getSerializedSize();<a name="line.2201"></a>
+<span class="sourceLineNo">2202</span>      metrics.dequeuedCall(qTime);<a name="line.2202"></a>
+<span class="sourceLineNo">2203</span>      metrics.processedCall(processingTime);<a name="line.2203"></a>
+<span class="sourceLineNo">2204</span>      metrics.totalCall(totalTime);<a name="line.2204"></a>
+<span class="sourceLineNo">2205</span>      metrics.receivedRequest(requestSize);<a name="line.2205"></a>
+<span class="sourceLineNo">2206</span>      metrics.sentResponse(responseSize);<a name="line.2206"></a>
+<span class="sourceLineNo">2207</span>      // log any RPC responses that are slower than the configured warn<a name="line.2207"></a>
+<span class="sourceLineNo">2208</span>      // response time or larger than configured warning size<a name="line.2208"></a>
+<span class="sourceLineNo">2209</span>      boolean tooSlow = (processingTime &gt; warnResponseTime &amp;&amp; warnResponseTime &gt; -1);<a name="line.2209"></a>
+<span class="sourceLineNo">2210</span>      boolean tooLarge = (responseSize &gt; warnResponseSize &amp;&amp; warnResponseSize &gt; -1);<a name="line.2210"></a>
+<span class="sourceLineNo">2211</span>      if (tooSlow || tooLarge) {<a name="line.2211"></a>
+<span class="sourceLineNo">2212</span>        // when tagging, we let TooLarge trump TooSmall to keep output simple<a name="line.2212"></a>
+<span class="sourceLineNo">2213</span>        // note that large responses will often also be slow.<a name="line.2213"></a>
+<span class="sourceLineNo">2214</span>        logResponse(new Object[]{param},<a name="line.2214"></a>
+<span class="sourceLineNo">2215</span>            md.getName(), md.getName() + "(" + param.getClass().getName() + ")",<a name="line.2215"></a>
+<span class="sourceLineNo">2216</span>            (tooLarge ? "TooLarge" : "TooSlow"),<a name="line.2216"></a>
+<span class="sourceLineNo">2217</span>            status.getClient(), startTime, processingTime, qTime,<a name="line.2217"></a>
+<span class="sourceLineNo">2218</span>            responseSize);<a name="line.2218"></a>
+<span class="sourceLineNo">2219</span>      }<a name="line.2219"></a>
+<span class="sourceLineNo">2220</span>      return new Pair&lt;Message, CellScanner&gt;(result, controller.cellScanner());<a name="line.2220"></a>
+<span class="sourceLineNo">2221</span>    } catch (Throwable e) {<a name="line.2221"></a>
+<span class="sourceLineNo">2222</span>      // The above callBlockingMethod will always return a SE.  Strip the SE wrapper before<a name="line.2222"></a>
+<span class="sourceLineNo">2223</span>      // putting it on the wire.  Its needed to adhere to the pb Service Interface but we don't<a name="line.2223"></a>
+<span class="sourceLineNo">2224</span>      // need to pass it over the wire.<a name="line.2224"></a>
+<span class="sourceLineNo">2225</span>      if (e instanceof ServiceException) e = e.getCause();<a name="line.2225"></a>
+<span class="sourceLineNo">2226</span><a name="line.2226"></a>
+<span class="sourceLineNo">2227</span>      // increment the number of requests that were exceptions.<a name="line.2227"></a>
+<span class="sourceLineNo">2228</span>      metrics.exception(e);<a name="line.2228"></a>
+<span class="sourceLineNo">2229</span><a name="line.2229"></a>
+<span class="sourceLineNo">2230</span>      if (e instanceof LinkageError) throw new DoNotRetryIOException(e);<a name="line.2230"></a>
+<span class="sourceLineNo">2231</span>      if (e instanceof IOException) throw (IOException)e;<a name="line.2231"></a>
+<span class="sourceLineNo">2232</span>      LOG.error("Unexpected throwable object ", e);<a name="line.2232"></a>
+<span class="sourceLineNo">2233</span>      throw new IOException(e.getMessage(), e);<a name="line.2233"></a>
+<span class="sourceLineNo">2234</span>    }<a name="line.2234"></a>
+<span class="sourceLineNo">2235</span>  }<a name="line.2235"></a>
+<span class="sourceLineNo">2236</span><a name="line.2236"></a>
+<span class="sourceLineNo">2237</span>  /**<a name="line.2237"></a>
+<span class="sourceLineNo">2238</span>   * Logs an RPC response to the LOG file, producing valid JSON objects for<a name="line.2238"></a>
+<span class="sourceLineNo">2239</span>   * client Operations.<a name="line.2239"></a>
+<span class="sourceLineNo">2240</span>   * @param params The parameters received in the call.<a name="line.2240"></a>
+<span class="sourceLineNo">2241</span>   * @param methodName The name of the method invoked<a name="line.2241"></a>
+<span class="sourceLineNo">2242</span>   * @param call The string representation of the call<a name="line.2242"></a>
+<span class="sourceLineNo">2243</span>   * @param tag  The tag that will be used to indicate this event in the log.<a name="line.2243"></a>
+<span class="sourceLineNo">2244</span>   * @param clientAddress   The address of the client who made this call.<a name="line.2244"></a>
+<span class="sourceLineNo">2245</span>   * @param startTime       The time that the call was initiated, in ms.<a name="line.2245"></a>
+<span class="sourceLineNo">2246</span>   * @param processingTime  The duration that the call took to run, in ms.<a name="line.2246"></a>
+<span class="sourceLineNo">2247</span>   * @param qTime           The duration that the call spent on the queue<a name="line.2247"></a>
+<span class="sourceLineNo">2248</span>   *                        prior to being initiated, in ms.<a name="line.2248"></a>
+<span class="sourceLineNo">2249</span>   * @param responseSize    The size in bytes of the response buffer.<a name="line.2249"></a>
+<span class="sourceLineNo">2250</span>   */<a name="line.2250"></a>
+<span class="sourceLineNo">2251</span>  void logResponse(Object[] params, String methodName, String call, String tag,<a name="line.2251"></a>
+<span class="sourceLineNo">2252</span>      String clientAddress, long startTime, int processingTime, int qTime,<a name="line.2252"></a>
+<span class="sourceLineNo">2253</span>      long responseSize)<a name="line.2253"></a>
+<span class="sourceLineNo">2254</span>          throws IOException {<a name="line.2254"></a>
+<span class="sourceLineNo">2255</span>    // base information that is reported regardless of type of call<a name="line.2255"></a>
+<span class="sourceLineNo">2256</span>    Map&lt;String, Object&gt; responseInfo = new HashMap&lt;String, Object&gt;();<a name="line.2256"></a>
+<span class="sourceLineNo">2257</span>    responseInfo.put("starttimems", startTime);<a name="line.2257"></a>
+<span class="sourceLineNo">2258</span>    responseInfo.put("processingtimems", processingTime);<a name="line.2258"></a>
+<span class="sourceLineNo">2259</span>    responseInfo.put("queuetimems", qTime);<a name="line.2259"></a>
+<span class="sourceLineNo">2260</span>    responseInfo.put("responsesize", responseSize);<a name="line.2260"></a>
+<span class="sourceLineNo">2261</span>    responseInfo.put("client", clientAddress);<a name="line.2261"></a>
+<span class="sourceLineNo">2262</span>    responseInfo.put("class", server == null? "": server.getClass().getSimpleName());<a name="line.2262"></a>
+<span class="sourceLineNo">2263</span>    responseInfo.put("method", methodName);<a name="line.2263"></a>
+<span class="sourceLineNo">2264</span>    if (params.length == 2 &amp;&amp; server instanceof HRegionServer &amp;&amp;<a name="line.2264"></a>
+<span class="sourceLineNo">2265</span>        params[0] instanceof byte[] &amp;&amp;<a name="line.2265"></a>
+<span class="sourceLineNo">2266</span>        params[1] instanceof Operation) {<a name="line.2266"></a>
+<span class="sourceLineNo">2267</span>      // if the slow process is a query, we want to log its table as well<a name="line.2267"></a>
+<span class="sourceLineNo">2268</span>      // as its own fingerprint<a name="line.2268"></a>
+<span class="sourceLineNo">2269</span>      TableName tableName = TableName.valueOf(<a name="line.2269"></a>
+<span class="sourceLineNo">2270</span>          HRegionInfo.parseRegionName((byte[]) params[0])[0]);<a name="line.2270"></a>
+<span class="sourceLineNo">2271</span>      responseInfo.put("table", tableName.getNameAsString());<a name="line.2271"></a>
+<span class="sourceLineNo">2272</span>      // annotate the response map with operation details<a name="line.2272"></a>
+<span class="sourceLineNo">2273</span>      responseInfo.putAll(((Operation) params[1]).toMap());<a name="line.2273"></a>
+<span class="sourceLineNo">2274</span>      // report to the log file<a name="line.2274"></a>
+<span class="sourceLineNo">2275</span>      LOG.warn("(operation" + tag + "): " +<a name="line.2275"></a>
+<span class="sourceLineNo">2276</span>               MAPPER.writeValueAsString(responseInfo));<a name="line.2276"></a>
+<span class="sourceLineNo">2277</span>    } else if (params.length == 1 &amp;&amp; server instanceof HRegionServer &amp;&amp;<a name="line.2277"></a>
+<span class="sourceLineNo">2278</span>        params[0] instanceof Operation) {<a name="line.2278"></a>
+<span class="sourceLineNo">2279</span>      // annotate the response map with operation details<a name="line.2279"></a>
+<span class="sourceLineNo">2280</span>      responseInfo.putAll(((Operation) params[0]).toMap());<a name="line.2280"></a>
+<span class="sourceLineNo">2281</span>      // report to the log file<a name="line.2281"></a>
+<span class="sourceLineNo">2282</span>      LOG.warn("(operation" + tag + "): " +<a name="line.2282"></a>
+<span class="sourceLineNo">2283</span>               MAPPER.writeValueAsString(responseInfo));<a name="line.2283"></a>
+<span class="sourceLineNo">2284</span>    } else {<a name="line.2284"></a>
+<span class="sourceLineNo">2285</span>      // can't get JSON details, so just report call.toString() along with<a name="line.2285"></a>
+<span class="sourceLineNo">2286</span>      // a more generic tag.<a name="line.2286"></a>
+<span class="sourceLineNo">2287</span>      responseInfo.put("call", call);<a name="line.2287"></a>
+<span class="sourceLineNo">2288</span>      LOG.warn("(response" + tag + "): " + MAPPER.writeValueAsString(responseInfo));<a name="line.2288"></a>
+<span class="sourceLineNo">2289</span>    }<a name="line.2289"></a>
+<span class="sourceLineNo">2290</span>  }<a name="line.2290"></a>
+<span class="sourceLineNo">2291</span><a name="line.2291"></a>
+<span class="sourceLineNo">2292</span>  /** Stops the service.  No new calls will be handled after this is called. */<a name="line.2292"></a>
+<span class="sourceLineNo">2293</span>  @Override<a name="line.2293"></a>
+<span class="sourceLineNo">2294</span>  public synchronized void stop() {<a name="line.2294"></a>
+<span class="sourceLineNo">2295</span>    LOG.info("Stopping server on " + port);<a name="line.2295"></a>
+<span class="sourceLineNo">2296</span>    running = false;<a name="line.2296"></a>
+<span class="sourceLineNo">2297</span>    if (authTokenSecretMgr != null) {<a name="line.2297"></a>
+<span class="sourceLineNo">2298</span>      authTokenSecretMgr.stop();<a name="line.2298"></a>
+<span class="sourceLineNo">2299</span>      authTokenSecretMgr = null;<a name="line.2299"></a>
+<span class="sourceLineNo">2300</span>    }<a name="line.2300"></a>
+<span class="sourceLineNo">2301</span>    listener.interrupt();<a name="line.2301"></a>
+<span class="sourceLineNo">2302</span>    listener.doStop();<a name="line.2302"></a>
+<span class="sourceLineNo">2303</span>    responder.interrupt();<a name="line.2303"></a>
+<span class="sourceLineNo">2304</span>    scheduler.stop();<a name="line.2304"></a>
+<span class="sourceLineNo">2305</span>    notifyAll();<a name="line.2305"></a>
+<span class="sourceLineNo">2306</span>  }<a name="line.2306"></a>
+<span class="sourceLineNo">2307</span><a name="line.2307"></a>
+<span class="sourceLineNo">2308</span>  /** Wait for the server to be stopped.<a name="line.2308"></a>
+<span class="sourceLineNo">2309</span>   * Does not wait for all subthreads to finish.<a name="line.2309"></a>
+<span class="sourceLineNo">2310</span>   *  See {@link #stop()}.<a name="line.2310"></a>
+<span class="sourceLineNo">2311</span>   * @throws InterruptedException e<a name="line.2311"></a>
+<span class="sourceLineNo">2312</span>   */<a name="line.2312"></a>
+<span class="sourceLineNo">2313</span>  @Override<a name="line.2313"></a>
+<span class="sourceLineNo">2314</span>  public synchronized void join() throws InterruptedException {<a name="line.2314"></a>
+<span class="sourceLineNo">2315</span>    while (running) {<a name="line.2315"></a>
+<span class="sourceLineNo">2316</span>      wait();<a name="line.2316"></a>
+<span class="sourceLineNo">2317</span>    }<a name="line.2317"></a>
+<span class="sourceLineNo">2318</span>  }<a name="line.2318"></a>
+<span class="sourceLineNo">2319</span><a name="line.2319"></a>
+<span class="sourceLineNo">2320</span>  /**<a name="line.2320"></a>
+<span class="sourceLineNo">2321</span>   * Return the socket (ip+port) on which the RPC server is listening to. May return null if<a name="line.2321"></a>
+<span class="sourceLineNo">2322</span>   * the listener channel is closed.<a name="line.2322"></a>
+<span class="sourceLineNo">2323</span>   * @return the socket (ip+port) on which the RPC server is listening to, or null if this<a name="line.2323"></a>
+<span class="sourceLineNo">2324</span>   * information cannot be determined<a name="line.2324"></a>
+<span class="sourceLineNo">2325</span>   */<a name="line.2325"></a>
+<span class="sourceLineNo">2326</span>  @Override<a name="line.2326"></a>
+<span class="sourceLineNo">2327</span>  public synchronized InetSocketAddress getListenerAddress() {<a name="line.2327"></a>
+<span class="sourceLineNo">2328</span>    if (listener == null) {<a name="line.2328"></a>
+<span class="sourceLineNo">2329</span>      return null;<a name="line.2329"></a>
+<span class="sourceLineNo">2330</span>    }<a name="line.2330"></a>
+<span class="sourceLineNo">2331</span>    return listener.getAddress();<a name="line.2331"></a>
+<span class="sourceLineNo">2332</span>  }<a name="line.2332"></a>
+<span class="sourceLineNo">2333</span><a name="line.2333"></a>
+<span class="sourceLineNo">2334</span>  /**<a name="line.2334"></a>
+<span class="sourceLineNo">2335</span>   * Set the handler for calling out of RPC for error conditions.<a name="line.2335"></a>
+<span class="sourceLineNo">2336</span>   * @param handler the handler implementation<a name="line.2336"></a>
+<span class="sourceLineNo">2337</span>   */<a name="line.2337"></a>
+<span class="sourceLineNo">2338</span>  @Override<a name="line.2338"></a>
+<span class="sourceLineNo">2339</span>  public void setErrorHandler(HBaseRPCErrorHandler handler) {<a name="line.2339"></a>
+<span class="sourceLineNo">2340</span>    this.errorHandler = handler;<a name="line.2340"></a>
+<span class="sourceLineNo">2341</span>  }<a name="line.2341"></a>
+<span class="sourceLineNo">2342</span><a name="line.2342"></a>
+<span class="sourceLineNo">2343</span>  @Override<a name="line.2343"></a>
+<span class="sourceLineNo">2344</span>  public HBaseRPCErrorHandler getErrorHandler() {<a name="line.2344"></a>
+<span class="sourceLineNo">2345</span>    return this.errorHandler;<a name="line.2345"></a>
+<span class="sourceLineNo">2346</span>  }<a name="line.2346"></a>
+<span class="sourceLineNo">2347</span><a name="line.2347"></a>
+<span class="sourceLineNo">2348</span>  /**<a name="line.2348"></a>
+<span class="sourceLineNo">2349</span>   * Returns the metrics instance for reporting RPC call statistics<a name="line.2349"></a>
+<span class="sourceLineNo">2350</span>   */<a name="line.2350"></a>
+<span class="sourceLineNo">2351</span>  @Override<a name="line.2351"></a>
+<span class="sourceLineNo">2352</span>  public MetricsHBaseServer getMetrics() {<a name="line.2352"></a>
+<span class="sourceLineNo">2353</span>    return metrics;<a name="line.2353"></a>
+<span class="sourceLineNo">2354</span>  }<a name="line.2354"></a>
+<span class="sourceLineNo">2355</span><a name="line.2355"></a>
+<span class="sourceLineNo">2356</span>  @Override<a name="line.2356"></a>
+<span class="sourceLineNo">2357</span>  public void addCallSize(final long diff) {<a name="line.2357"></a>
+<span class="sourceLineNo">2358</span>    this.callQueueSize.add(diff);<a name="line.2358"></a>
+<span class="sourceLineNo">2359</span>  }<a name="line.2359"></a>
+<span class="sourceLineNo">2360</span><a name="line.2360"></a>
+<span class="sourceLineNo">2361</span>  /**<a name="line.2361"></a>
+<span class="sourceLineNo">2362</span>   * Authorize the incoming client connection.<a name="line.2362"></a>
+<span class="sourceLineNo">2363</span>   *<a name="line.2363"></a>
+<span class="sourceLineNo">2364</span>   * @param user client user<a name="line.2364"></a>
+<span class="sourceLineNo">2365</span>   * @param connection incoming connection<a name="line.2365"></a>
+<span class="sourceLineNo">2366</span>   * @param addr InetAddress of incoming connection<a name="line.2366"></a>
+<span class="sourceLineNo">2367</span>   * @throws org.apache.hadoop.security.authorize.AuthorizationException<a name="line.2367"></a>
+<span class="sourceLineNo">2368</span>   *         when the client isn't authorized to talk the protocol<a name="line.2368"></a>
+<span class="sourceLineNo">2369</span>   */<a name="line.2369"></a>
+<span class="sourceLineNo">2370</span>  public void authorize(UserGroupInformation user, ConnectionHeader connection, InetAddress addr)<a name="line.2370"></a>
+<span class="sourceLineNo">2371</span>  throws AuthorizationException {<a name="line.2371"></a>
+<span class="sourceLineNo">2372</span>    if (authorize) {<a name="line.2372"></a>
+<span class="sourceLineNo">2373</span>      Class&lt;?&gt; c = getServiceInterface(services, connection.getServiceName());<a name="line.2373"></a>
+<span class="sourceLineNo">2374</span>      this.authManager.authorize(user != null ? user : null, c, getConf(), addr);<a name="line.2374"></a>
+<span class="sourceLineNo">2375</span>    }<a name="line.2375"></a>
+<span class="sourceLineNo">2376</span>  }<a name="line.2376"></a>
+<span class="sourceLineNo">2377</span><a name="line.2377"></a>
+<span class="sourceLineNo">2378</span>  /**<a name="line.2378"></a>
+<span class="sourceLineNo">2379</span>   * When the read or write buffer size is larger than this limit, i/o will be<a name="line.2379"></a>
+<span class="sourceLineNo">2380</span>   * done in chunks of this size. Most RPC requests and responses would be<a name="line.2380"></a>
+<span class="sourceLineNo">2381</span>   * be smaller.<a name="line.2381"></a>
+<span class="sourceLineNo">2382</span>   */<a name="line.2382"></a>
+<span class="sourceLineNo">2383</span>  private static int NIO_BUFFER_LIMIT = 64 * 1024; //should not be more than 64KB.<a name="line.2383"></a>
+<span class="sourceLineNo">2384</span><a name="line.2384"></a>
+<span class="sourceLineNo">2385</span>  /**<a name="line.2385"></a>
+<span class="sourceLineNo">2386</span>   * This is a wrapper around {@link java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer)}.<a name="line.2386"></a>
+<span class="sourceLineNo">2387</span>   * If the amount of data is large, it writes to channel in smaller chunks.<a name="line.2387"></a>
+<span class="sourceLineNo">2388</span>   * This is to avoid jdk from creating many direct buffers as the size of<a name="line.2388"></a>
+<span class="sourceLineNo">2389</span>   * buffer increases. This also minimizes extra copies in NIO layer<a name="line.2389"></a>
+<span class="sourceLineNo">2390</span>   * as a result of multiple write operations required to write a large<a name="line.2390"></a>
+<span class="sourceLineNo">2391</span>   * buffer.<a name="line.2391"></a>
+<span class="sourceLineNo">2392</span>   *<a name="line.2392"></a>
+<span class="sourceLineNo">2393</span>   * @param channel writable byte channel to write to<a name="line.2393"></a>
+<span class="sourceLineNo">2394</span>   * @param bufferChain Chain of buffers to write<a name="line.2394"></a>
+<span class="sourceLineNo">2395</span>   * @return number of bytes written<a name="line.2395"></a>
+<span class="sourceLineNo">2396</span>   * @throws java.io.IOException e<a name="line.2396"></a>
+<span class="sourceLineNo">2397</span>   * @see java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer)<a name="line.2397"></a>
+<span class="sourceLineNo">2398</span>   */<a name="line.2398"></a>
+<span class="sourceLineNo">2399</span>  protected long channelWrite(GatheringByteChannel channel, BufferChain bufferChain)<a name="line.2399"></a>
+<span class="sourceLineNo">2400</span>  throws IOException {<a name="line.2400"></a>
+<span class="sourceLineNo">2401</span>    long count =  bufferChain.write(channel, NIO_BUFFER_LIMIT);<a name="line.2401"></a>
+<span class="sourceLineNo">2402</span>    if (count &gt; 0) this.metrics.sentBytes(count);<a name="line.2402"></a>
+<span class="sourceLineNo">2403</span>    return count;<a name="line.2403"></a>
+<span class="sourceLineNo">2404</span>  }<a name="line.2404"></a>
+<span class="sourceLineNo">2405</span><a name="line.2405"></a>
+<span class="sourceLineNo">2406</span>  /**<a name="line.2406"></a>
+<span class="sourceLineNo">2407</span>   * This is a wrapper around {@link java.nio.channels.ReadableByteChannel#read(java.nio.ByteBuffer)}.<a name="line.2407"></a>
+<span class="sourceLineNo">2408</span>   * If the amount of data is large, it writes to channel in smaller chunks.<a name="line.2408"></a>
+<span class="sourceLineNo">2409</span>   * This is to avoid jdk from creating many direct buffers as the size of<a name="line.2409"></a>
+<span class="sourceLineNo">2410</span>   * ByteBuffer increases. There should not be any performance degredation.<a name="line.2410"></a>
+<span class="sourceLineNo">2411</span>   *<a name="line.2411"></a>
+<span class="sourceLineNo">2412</span>   * @param channel writable byte channel to write on<a name="line.2412"></a>
+<span class="sourceLineNo">2413</span>   * @param buffer buffer to write<a name="line.2413"></a>
+<span class="sourceLineNo">2414</span>   * @return number of bytes written<a name="line.2414"></a>
+<span class="sourceLineNo">2415</span>   * @throws java.io.IOException e<a name="line.2415"></a>
+<span class="sourceLineNo">2416</span>   * @see java.nio.channels.ReadableByteChannel#read(java.nio.ByteBuffer)<a name="line.2416"></a>
+<span class="sourceLineNo">2417</span>   */<a name="line.2417"></a>
+<span class="sourceLineNo">2418</span>  protected int channelRead(ReadableByteChannel channel,<a name="line.2418"></a>
+<span class="sourceLineNo">2419</span>                                   ByteBuffer buffer) throws IOException {<a name="line.2419"></a>
+<span class="sourceLineNo">2420</span><a name="line.2420"></a>
+<span class="sourceLineNo">2421</span>    int count = (buffer.remaining() &lt;= NIO_BUFFER_LIMIT) ?<a name="line.2421"></a>
+<span class="sourceLineNo">2422</span>           channel.read(buffer) : channelIO(channel, null, buffer);<a name="line.2422"></a>
+<span class="sourceLineNo">2423</span>    if (count &gt; 0) {<a name="line.2423"></a>
+<span class="sourceLineNo">2424</span>      metrics.receivedBytes(count);<a name="line.2424"></a>
+<span class="sourceLineNo">2425</span>    }<a name="line.2425"></a>
+<span class="sourceLineNo">2426</span>    return count;<a name="line.2426"></a>
+<span class="sourceLineNo">2427</span>  }<a name="line.2427"></a>
+<span class="sourceLineNo">2428</span><a name="line.2428"></a>
+<span class="sourceLineNo">2429</span>  /**<a name="line.2429"></a>
+<span class="sourceLineNo">2430</span>   * Helper for {@link #channelRead(java.nio.channels.ReadableByteChannel, java.nio.ByteBuffer)}<a name="line.2430"></a>
+<span class="sourceLineNo">2431</span>   * a

<TRUNCATED>

Mime
View raw message