hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [26/51] [partial] hbase-site git commit: Published site at 07b623670647686084f8f5fd2038e2bafcfdac54.
Date Wed, 30 Dec 2015 22:15:47 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/e5c3dcd1/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcClient.RpcChannelImplementation.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcClient.RpcChannelImplementation.html b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcClient.RpcChannelImplementation.html
index c9ae0e6..dfa8ee0 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcClient.RpcChannelImplementation.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/ipc/AsyncRpcClient.RpcChannelImplementation.html
@@ -259,255 +259,256 @@
 <span class="sourceLineNo">251</span>      if (e.getCause() instanceof IOException) {<a name="line.251"></a>
 <span class="sourceLineNo">252</span>        throw (IOException) e.getCause();<a name="line.252"></a>
 <span class="sourceLineNo">253</span>      } else {<a name="line.253"></a>
-<span class="sourceLineNo">254</span>        throw new IOException(e.getCause());<a name="line.254"></a>
+<span class="sourceLineNo">254</span>        throw wrapException(addr, (Exception) e.getCause());<a name="line.254"></a>
 <span class="sourceLineNo">255</span>      }<a name="line.255"></a>
 <span class="sourceLineNo">256</span>    } catch (TimeoutException e) {<a name="line.256"></a>
-<span class="sourceLineNo">257</span>      throw new CallTimeoutException(promise.toString());<a name="line.257"></a>
-<span class="sourceLineNo">258</span>    }<a name="line.258"></a>
-<span class="sourceLineNo">259</span>  }<a name="line.259"></a>
-<span class="sourceLineNo">260</span><a name="line.260"></a>
-<span class="sourceLineNo">261</span>  /**<a name="line.261"></a>
-<span class="sourceLineNo">262</span>   * Call method async<a name="line.262"></a>
-<span class="sourceLineNo">263</span>   */<a name="line.263"></a>
-<span class="sourceLineNo">264</span>  private void callMethod(final Descriptors.MethodDescriptor md,<a name="line.264"></a>
-<span class="sourceLineNo">265</span>      final PayloadCarryingRpcController pcrc, final Message param, Message returnType, User ticket,<a name="line.265"></a>
-<span class="sourceLineNo">266</span>      InetSocketAddress addr, final RpcCallback&lt;Message&gt; done) {<a name="line.266"></a>
-<span class="sourceLineNo">267</span>    final AsyncRpcChannel connection;<a name="line.267"></a>
-<span class="sourceLineNo">268</span>    try {<a name="line.268"></a>
-<span class="sourceLineNo">269</span>      connection = createRpcChannel(md.getService().getName(), addr, ticket);<a name="line.269"></a>
-<span class="sourceLineNo">270</span>      final MetricsConnection.CallStats cs = MetricsConnection.newCallStats();<a name="line.270"></a>
-<span class="sourceLineNo">271</span>      GenericFutureListener&lt;Future&lt;Message&gt;&gt; listener =<a name="line.271"></a>
-<span class="sourceLineNo">272</span>          new GenericFutureListener&lt;Future&lt;Message&gt;&gt;() {<a name="line.272"></a>
-<span class="sourceLineNo">273</span>            @Override<a name="line.273"></a>
-<span class="sourceLineNo">274</span>            public void operationComplete(Future&lt;Message&gt; future) throws Exception {<a name="line.274"></a>
-<span class="sourceLineNo">275</span>              cs.setCallTimeMs(EnvironmentEdgeManager.currentTime() - cs.getStartTime());<a name="line.275"></a>
-<span class="sourceLineNo">276</span>              if (metrics != null) {<a name="line.276"></a>
-<span class="sourceLineNo">277</span>                metrics.updateRpc(md, param, cs);<a name="line.277"></a>
-<span class="sourceLineNo">278</span>              }<a name="line.278"></a>
-<span class="sourceLineNo">279</span>              if (LOG.isTraceEnabled()) {<a name="line.279"></a>
-<span class="sourceLineNo">280</span>                LOG.trace("Call: " + md.getName() + ", callTime: " + cs.getCallTimeMs() + "ms");<a name="line.280"></a>
-<span class="sourceLineNo">281</span>              }<a name="line.281"></a>
-<span class="sourceLineNo">282</span>              if (!future.isSuccess()) {<a name="line.282"></a>
-<span class="sourceLineNo">283</span>                Throwable cause = future.cause();<a name="line.283"></a>
-<span class="sourceLineNo">284</span>                if (cause instanceof IOException) {<a name="line.284"></a>
-<span class="sourceLineNo">285</span>                  pcrc.setFailed((IOException) cause);<a name="line.285"></a>
-<span class="sourceLineNo">286</span>                } else {<a name="line.286"></a>
-<span class="sourceLineNo">287</span>                  pcrc.setFailed(new IOException(cause));<a name="line.287"></a>
-<span class="sourceLineNo">288</span>                }<a name="line.288"></a>
-<span class="sourceLineNo">289</span>              } else {<a name="line.289"></a>
-<span class="sourceLineNo">290</span>                try {<a name="line.290"></a>
-<span class="sourceLineNo">291</span>                  done.run(future.get());<a name="line.291"></a>
-<span class="sourceLineNo">292</span>                } catch (ExecutionException e) {<a name="line.292"></a>
-<span class="sourceLineNo">293</span>                  Throwable cause = e.getCause();<a name="line.293"></a>
-<span class="sourceLineNo">294</span>                  if (cause instanceof IOException) {<a name="line.294"></a>
-<span class="sourceLineNo">295</span>                    pcrc.setFailed((IOException) cause);<a name="line.295"></a>
-<span class="sourceLineNo">296</span>                  } else {<a name="line.296"></a>
-<span class="sourceLineNo">297</span>                    pcrc.setFailed(new IOException(cause));<a name="line.297"></a>
-<span class="sourceLineNo">298</span>                  }<a name="line.298"></a>
-<span class="sourceLineNo">299</span>                } catch (InterruptedException e) {<a name="line.299"></a>
-<span class="sourceLineNo">300</span>                  pcrc.setFailed(new IOException(e));<a name="line.300"></a>
-<span class="sourceLineNo">301</span>                }<a name="line.301"></a>
-<span class="sourceLineNo">302</span>              }<a name="line.302"></a>
-<span class="sourceLineNo">303</span>            }<a name="line.303"></a>
-<span class="sourceLineNo">304</span>          };<a name="line.304"></a>
-<span class="sourceLineNo">305</span>      cs.setStartTime(EnvironmentEdgeManager.currentTime());<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      connection.callMethod(md, pcrc, param, returnType, cs).addListener(listener);<a name="line.306"></a>
-<span class="sourceLineNo">307</span>    } catch (StoppedRpcClientException|FailedServerException e) {<a name="line.307"></a>
-<span class="sourceLineNo">308</span>      pcrc.setFailed(e);<a name="line.308"></a>
-<span class="sourceLineNo">309</span>    }<a name="line.309"></a>
-<span class="sourceLineNo">310</span>  }<a name="line.310"></a>
-<span class="sourceLineNo">311</span><a name="line.311"></a>
-<span class="sourceLineNo">312</span>  private boolean closed = false;<a name="line.312"></a>
-<span class="sourceLineNo">313</span><a name="line.313"></a>
-<span class="sourceLineNo">314</span>  /**<a name="line.314"></a>
-<span class="sourceLineNo">315</span>   * Close netty<a name="line.315"></a>
-<span class="sourceLineNo">316</span>   */<a name="line.316"></a>
-<span class="sourceLineNo">317</span>  public void close() {<a name="line.317"></a>
-<span class="sourceLineNo">318</span>    if (LOG.isDebugEnabled()) {<a name="line.318"></a>
-<span class="sourceLineNo">319</span>      LOG.debug("Stopping async HBase RPC client");<a name="line.319"></a>
-<span class="sourceLineNo">320</span>    }<a name="line.320"></a>
-<span class="sourceLineNo">321</span><a name="line.321"></a>
-<span class="sourceLineNo">322</span>    synchronized (connections) {<a name="line.322"></a>
-<span class="sourceLineNo">323</span>      if (closed) {<a name="line.323"></a>
-<span class="sourceLineNo">324</span>        return;<a name="line.324"></a>
-<span class="sourceLineNo">325</span>      }<a name="line.325"></a>
-<span class="sourceLineNo">326</span>      closed = true;<a name="line.326"></a>
-<span class="sourceLineNo">327</span>      for (AsyncRpcChannel conn : connections.values()) {<a name="line.327"></a>
-<span class="sourceLineNo">328</span>        conn.close(null);<a name="line.328"></a>
-<span class="sourceLineNo">329</span>      }<a name="line.329"></a>
-<span class="sourceLineNo">330</span>    }<a name="line.330"></a>
-<span class="sourceLineNo">331</span>    // do not close global EventLoopGroup.<a name="line.331"></a>
-<span class="sourceLineNo">332</span>    if (!useGlobalEventLoopGroup) {<a name="line.332"></a>
-<span class="sourceLineNo">333</span>      bootstrap.group().shutdownGracefully();<a name="line.333"></a>
-<span class="sourceLineNo">334</span>    }<a name="line.334"></a>
-<span class="sourceLineNo">335</span>  }<a name="line.335"></a>
-<span class="sourceLineNo">336</span><a name="line.336"></a>
-<span class="sourceLineNo">337</span>  /**<a name="line.337"></a>
-<span class="sourceLineNo">338</span>   * Create a cell scanner<a name="line.338"></a>
-<span class="sourceLineNo">339</span>   *<a name="line.339"></a>
-<span class="sourceLineNo">340</span>   * @param cellBlock to create scanner for<a name="line.340"></a>
-<span class="sourceLineNo">341</span>   * @return CellScanner<a name="line.341"></a>
-<span class="sourceLineNo">342</span>   * @throws java.io.IOException on error on creation cell scanner<a name="line.342"></a>
-<span class="sourceLineNo">343</span>   */<a name="line.343"></a>
-<span class="sourceLineNo">344</span>  public CellScanner createCellScanner(byte[] cellBlock) throws IOException {<a name="line.344"></a>
-<span class="sourceLineNo">345</span>    return ipcUtil.createCellScanner(this.codec, this.compressor, cellBlock);<a name="line.345"></a>
-<span class="sourceLineNo">346</span>  }<a name="line.346"></a>
-<span class="sourceLineNo">347</span><a name="line.347"></a>
-<span class="sourceLineNo">348</span>  /**<a name="line.348"></a>
-<span class="sourceLineNo">349</span>   * Build cell block<a name="line.349"></a>
-<span class="sourceLineNo">350</span>   *<a name="line.350"></a>
-<span class="sourceLineNo">351</span>   * @param cells to create block with<a name="line.351"></a>
-<span class="sourceLineNo">352</span>   * @return ByteBuffer with cells<a name="line.352"></a>
-<span class="sourceLineNo">353</span>   * @throws java.io.IOException if block creation fails<a name="line.353"></a>
-<span class="sourceLineNo">354</span>   */<a name="line.354"></a>
-<span class="sourceLineNo">355</span>  public ByteBuffer buildCellBlock(CellScanner cells) throws IOException {<a name="line.355"></a>
-<span class="sourceLineNo">356</span>    return ipcUtil.buildCellBlock(this.codec, this.compressor, cells);<a name="line.356"></a>
-<span class="sourceLineNo">357</span>  }<a name="line.357"></a>
-<span class="sourceLineNo">358</span><a name="line.358"></a>
-<span class="sourceLineNo">359</span>  /**<a name="line.359"></a>
-<span class="sourceLineNo">360</span>   * Creates an RPC client<a name="line.360"></a>
-<span class="sourceLineNo">361</span>   *<a name="line.361"></a>
-<span class="sourceLineNo">362</span>   * @param serviceName    name of servicce<a name="line.362"></a>
-<span class="sourceLineNo">363</span>   * @param location       to connect to<a name="line.363"></a>
-<span class="sourceLineNo">364</span>   * @param ticket         for current user<a name="line.364"></a>
-<span class="sourceLineNo">365</span>   * @return new RpcChannel<a name="line.365"></a>
-<span class="sourceLineNo">366</span>   * @throws StoppedRpcClientException when Rpc client is stopped<a name="line.366"></a>
-<span class="sourceLineNo">367</span>   * @throws FailedServerException if server failed<a name="line.367"></a>
-<span class="sourceLineNo">368</span>   */<a name="line.368"></a>
-<span class="sourceLineNo">369</span>  private AsyncRpcChannel createRpcChannel(String serviceName, InetSocketAddress location,<a name="line.369"></a>
-<span class="sourceLineNo">370</span>      User ticket) throws StoppedRpcClientException, FailedServerException {<a name="line.370"></a>
-<span class="sourceLineNo">371</span>    // Check if server is failed<a name="line.371"></a>
-<span class="sourceLineNo">372</span>    if (this.failedServers.isFailedServer(location)) {<a name="line.372"></a>
-<span class="sourceLineNo">373</span>      if (LOG.isDebugEnabled()) {<a name="line.373"></a>
-<span class="sourceLineNo">374</span>        LOG.debug("Not trying to connect to " + location +<a name="line.374"></a>
-<span class="sourceLineNo">375</span>            " this server is in the failed servers list");<a name="line.375"></a>
-<span class="sourceLineNo">376</span>      }<a name="line.376"></a>
-<span class="sourceLineNo">377</span>      throw new FailedServerException(<a name="line.377"></a>
-<span class="sourceLineNo">378</span>          "This server is in the failed servers list: " + location);<a name="line.378"></a>
-<span class="sourceLineNo">379</span>    }<a name="line.379"></a>
-<span class="sourceLineNo">380</span><a name="line.380"></a>
-<span class="sourceLineNo">381</span>    int hashCode = ConnectionId.hashCode(ticket,serviceName,location);<a name="line.381"></a>
-<span class="sourceLineNo">382</span><a name="line.382"></a>
-<span class="sourceLineNo">383</span>    AsyncRpcChannel rpcChannel;<a name="line.383"></a>
-<span class="sourceLineNo">384</span>    synchronized (connections) {<a name="line.384"></a>
-<span class="sourceLineNo">385</span>      if (closed) {<a name="line.385"></a>
-<span class="sourceLineNo">386</span>        throw new StoppedRpcClientException();<a name="line.386"></a>
-<span class="sourceLineNo">387</span>      }<a name="line.387"></a>
-<span class="sourceLineNo">388</span>      rpcChannel = connections.get(hashCode);<a name="line.388"></a>
-<span class="sourceLineNo">389</span>      if (rpcChannel != null &amp;&amp; !rpcChannel.isAlive()) {<a name="line.389"></a>
-<span class="sourceLineNo">390</span>        LOG.debug("Removing dead channel from server="+rpcChannel.address.toString());<a name="line.390"></a>
-<span class="sourceLineNo">391</span>        connections.remove(hashCode);<a name="line.391"></a>
-<span class="sourceLineNo">392</span>      }<a name="line.392"></a>
-<span class="sourceLineNo">393</span>      if (rpcChannel == null) {<a name="line.393"></a>
-<span class="sourceLineNo">394</span>        rpcChannel = new AsyncRpcChannel(this.bootstrap, this, ticket, serviceName, location);<a name="line.394"></a>
-<span class="sourceLineNo">395</span>        connections.put(hashCode, rpcChannel);<a name="line.395"></a>
-<span class="sourceLineNo">396</span>      }<a name="line.396"></a>
-<span class="sourceLineNo">397</span>    }<a name="line.397"></a>
-<span class="sourceLineNo">398</span><a name="line.398"></a>
-<span class="sourceLineNo">399</span>    return rpcChannel;<a name="line.399"></a>
-<span class="sourceLineNo">400</span>  }<a name="line.400"></a>
-<span class="sourceLineNo">401</span><a name="line.401"></a>
-<span class="sourceLineNo">402</span>  /**<a name="line.402"></a>
-<span class="sourceLineNo">403</span>   * Interrupt the connections to the given ip:port server. This should be called if the server<a name="line.403"></a>
-<span class="sourceLineNo">404</span>   * is known as actually dead. This will not prevent current operation to be retried, and,<a name="line.404"></a>
-<span class="sourceLineNo">405</span>   * depending on their own behavior, they may retry on the same server. This can be a feature,<a name="line.405"></a>
-<span class="sourceLineNo">406</span>   * for example at startup. In any case, they're likely to get connection refused (if the<a name="line.406"></a>
-<span class="sourceLineNo">407</span>   * process died) or no route to host: i.e. there next retries should be faster and with a<a name="line.407"></a>
-<span class="sourceLineNo">408</span>   * safe exception.<a name="line.408"></a>
-<span class="sourceLineNo">409</span>   *<a name="line.409"></a>
-<span class="sourceLineNo">410</span>   * @param sn server to cancel connections for<a name="line.410"></a>
-<span class="sourceLineNo">411</span>   */<a name="line.411"></a>
-<span class="sourceLineNo">412</span>  @Override<a name="line.412"></a>
-<span class="sourceLineNo">413</span>  public void cancelConnections(ServerName sn) {<a name="line.413"></a>
-<span class="sourceLineNo">414</span>    synchronized (connections) {<a name="line.414"></a>
-<span class="sourceLineNo">415</span>      for (AsyncRpcChannel rpcChannel : connections.values()) {<a name="line.415"></a>
-<span class="sourceLineNo">416</span>        if (rpcChannel.isAlive() &amp;&amp;<a name="line.416"></a>
-<span class="sourceLineNo">417</span>            rpcChannel.address.getPort() == sn.getPort() &amp;&amp;<a name="line.417"></a>
-<span class="sourceLineNo">418</span>            rpcChannel.address.getHostName().contentEquals(sn.getHostname())) {<a name="line.418"></a>
-<span class="sourceLineNo">419</span>          LOG.info("The server on " + sn.toString() +<a name="line.419"></a>
-<span class="sourceLineNo">420</span>              " is dead - stopping the connection " + rpcChannel.toString());<a name="line.420"></a>
-<span class="sourceLineNo">421</span>          rpcChannel.close(null);<a name="line.421"></a>
-<span class="sourceLineNo">422</span>        }<a name="line.422"></a>
-<span class="sourceLineNo">423</span>      }<a name="line.423"></a>
-<span class="sourceLineNo">424</span>    }<a name="line.424"></a>
-<span class="sourceLineNo">425</span>  }<a name="line.425"></a>
-<span class="sourceLineNo">426</span><a name="line.426"></a>
-<span class="sourceLineNo">427</span>  /**<a name="line.427"></a>
-<span class="sourceLineNo">428</span>   * Remove connection from pool<a name="line.428"></a>
-<span class="sourceLineNo">429</span>   */<a name="line.429"></a>
-<span class="sourceLineNo">430</span>  public void removeConnection(AsyncRpcChannel connection) {<a name="line.430"></a>
-<span class="sourceLineNo">431</span>    int connectionHashCode = connection.hashCode();<a name="line.431"></a>
-<span class="sourceLineNo">432</span>    synchronized (connections) {<a name="line.432"></a>
-<span class="sourceLineNo">433</span>      // we use address as cache key, so we should check here to prevent removing the<a name="line.433"></a>
-<span class="sourceLineNo">434</span>      // wrong connection<a name="line.434"></a>
-<span class="sourceLineNo">435</span>      AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode);<a name="line.435"></a>
-<span class="sourceLineNo">436</span>      if (connectionInPool != null &amp;&amp; connectionInPool.equals(connection)) {<a name="line.436"></a>
-<span class="sourceLineNo">437</span>        this.connections.remove(connectionHashCode);<a name="line.437"></a>
-<span class="sourceLineNo">438</span>      } else if (LOG.isDebugEnabled()) {<a name="line.438"></a>
-<span class="sourceLineNo">439</span>        LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",<a name="line.439"></a>
-<span class="sourceLineNo">440</span>          connection.toString(), System.identityHashCode(connection),<a name="line.440"></a>
-<span class="sourceLineNo">441</span>          System.identityHashCode(connectionInPool)));<a name="line.441"></a>
-<span class="sourceLineNo">442</span>      }<a name="line.442"></a>
-<span class="sourceLineNo">443</span>    }<a name="line.443"></a>
-<span class="sourceLineNo">444</span>  }<a name="line.444"></a>
-<span class="sourceLineNo">445</span><a name="line.445"></a>
-<span class="sourceLineNo">446</span>  /**<a name="line.446"></a>
-<span class="sourceLineNo">447</span>   * Creates a "channel" that can be used by a protobuf service.  Useful setting up<a name="line.447"></a>
-<span class="sourceLineNo">448</span>   * protobuf stubs.<a name="line.448"></a>
-<span class="sourceLineNo">449</span>   *<a name="line.449"></a>
-<span class="sourceLineNo">450</span>   * @param sn server name describing location of server<a name="line.450"></a>
-<span class="sourceLineNo">451</span>   * @param user which is to use the connection<a name="line.451"></a>
-<span class="sourceLineNo">452</span>   * @param rpcTimeout default rpc operation timeout<a name="line.452"></a>
-<span class="sourceLineNo">453</span>   *<a name="line.453"></a>
-<span class="sourceLineNo">454</span>   * @return A rpc channel that goes via this rpc client instance.<a name="line.454"></a>
-<span class="sourceLineNo">455</span>   */<a name="line.455"></a>
-<span class="sourceLineNo">456</span>  public RpcChannel createRpcChannel(final ServerName sn, final User user, int rpcTimeout) {<a name="line.456"></a>
-<span class="sourceLineNo">457</span>    return new RpcChannelImplementation(this, sn, user, rpcTimeout);<a name="line.457"></a>
-<span class="sourceLineNo">458</span>  }<a name="line.458"></a>
-<span class="sourceLineNo">459</span><a name="line.459"></a>
-<span class="sourceLineNo">460</span>  /**<a name="line.460"></a>
-<span class="sourceLineNo">461</span>   * Blocking rpc channel that goes via hbase rpc.<a name="line.461"></a>
-<span class="sourceLineNo">462</span>   */<a name="line.462"></a>
-<span class="sourceLineNo">463</span>  @VisibleForTesting<a name="line.463"></a>
-<span class="sourceLineNo">464</span>  public static class RpcChannelImplementation implements RpcChannel {<a name="line.464"></a>
-<span class="sourceLineNo">465</span>    private final InetSocketAddress isa;<a name="line.465"></a>
-<span class="sourceLineNo">466</span>    private final AsyncRpcClient rpcClient;<a name="line.466"></a>
-<span class="sourceLineNo">467</span>    private final User ticket;<a name="line.467"></a>
-<span class="sourceLineNo">468</span>    private final int channelOperationTimeout;<a name="line.468"></a>
-<span class="sourceLineNo">469</span><a name="line.469"></a>
-<span class="sourceLineNo">470</span>    /**<a name="line.470"></a>
-<span class="sourceLineNo">471</span>     * @param channelOperationTimeout - the default timeout when no timeout is given<a name="line.471"></a>
-<span class="sourceLineNo">472</span>     */<a name="line.472"></a>
-<span class="sourceLineNo">473</span>    protected RpcChannelImplementation(final AsyncRpcClient rpcClient,<a name="line.473"></a>
-<span class="sourceLineNo">474</span>        final ServerName sn, final User ticket, int channelOperationTimeout) {<a name="line.474"></a>
-<span class="sourceLineNo">475</span>      this.isa = new InetSocketAddress(sn.getHostname(), sn.getPort());<a name="line.475"></a>
-<span class="sourceLineNo">476</span>      this.rpcClient = rpcClient;<a name="line.476"></a>
-<span class="sourceLineNo">477</span>      this.ticket = ticket;<a name="line.477"></a>
-<span class="sourceLineNo">478</span>      this.channelOperationTimeout = channelOperationTimeout;<a name="line.478"></a>
-<span class="sourceLineNo">479</span>    }<a name="line.479"></a>
-<span class="sourceLineNo">480</span><a name="line.480"></a>
-<span class="sourceLineNo">481</span>    @Override<a name="line.481"></a>
-<span class="sourceLineNo">482</span>    public void callMethod(Descriptors.MethodDescriptor md, RpcController controller,<a name="line.482"></a>
-<span class="sourceLineNo">483</span>        Message param, Message returnType, RpcCallback&lt;Message&gt; done) {<a name="line.483"></a>
-<span class="sourceLineNo">484</span>      PayloadCarryingRpcController pcrc;<a name="line.484"></a>
-<span class="sourceLineNo">485</span>      if (controller != null) {<a name="line.485"></a>
-<span class="sourceLineNo">486</span>        pcrc = (PayloadCarryingRpcController) controller;<a name="line.486"></a>
-<span class="sourceLineNo">487</span>        if (!pcrc.hasCallTimeout()) {<a name="line.487"></a>
-<span class="sourceLineNo">488</span>          pcrc.setCallTimeout(channelOperationTimeout);<a name="line.488"></a>
-<span class="sourceLineNo">489</span>        }<a name="line.489"></a>
-<span class="sourceLineNo">490</span>      } else {<a name="line.490"></a>
-<span class="sourceLineNo">491</span>        pcrc = new PayloadCarryingRpcController();<a name="line.491"></a>
-<span class="sourceLineNo">492</span>        pcrc.setCallTimeout(channelOperationTimeout);<a name="line.492"></a>
-<span class="sourceLineNo">493</span>      }<a name="line.493"></a>
-<span class="sourceLineNo">494</span><a name="line.494"></a>
-<span class="sourceLineNo">495</span>      this.rpcClient.callMethod(md, pcrc, param, returnType, this.ticket, this.isa, done);<a name="line.495"></a>
-<span class="sourceLineNo">496</span>    }<a name="line.496"></a>
-<span class="sourceLineNo">497</span>  }<a name="line.497"></a>
-<span class="sourceLineNo">498</span><a name="line.498"></a>
-<span class="sourceLineNo">499</span>  Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {<a name="line.499"></a>
-<span class="sourceLineNo">500</span>    return WHEEL_TIMER.newTimeout(task, delay, unit);<a name="line.500"></a>
-<span class="sourceLineNo">501</span>  }<a name="line.501"></a>
-<span class="sourceLineNo">502</span>}<a name="line.502"></a>
+<span class="sourceLineNo">257</span>      CallTimeoutException cte = new CallTimeoutException(promise.toString());<a name="line.257"></a>
+<span class="sourceLineNo">258</span>      throw wrapException(addr, cte);<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    }<a name="line.259"></a>
+<span class="sourceLineNo">260</span>  }<a name="line.260"></a>
+<span class="sourceLineNo">261</span><a name="line.261"></a>
+<span class="sourceLineNo">262</span>  /**<a name="line.262"></a>
+<span class="sourceLineNo">263</span>   * Call method async<a name="line.263"></a>
+<span class="sourceLineNo">264</span>   */<a name="line.264"></a>
+<span class="sourceLineNo">265</span>  private void callMethod(final Descriptors.MethodDescriptor md,<a name="line.265"></a>
+<span class="sourceLineNo">266</span>      final PayloadCarryingRpcController pcrc, final Message param, Message returnType, User ticket,<a name="line.266"></a>
+<span class="sourceLineNo">267</span>      InetSocketAddress addr, final RpcCallback&lt;Message&gt; done) {<a name="line.267"></a>
+<span class="sourceLineNo">268</span>    final AsyncRpcChannel connection;<a name="line.268"></a>
+<span class="sourceLineNo">269</span>    try {<a name="line.269"></a>
+<span class="sourceLineNo">270</span>      connection = createRpcChannel(md.getService().getName(), addr, ticket);<a name="line.270"></a>
+<span class="sourceLineNo">271</span>      final MetricsConnection.CallStats cs = MetricsConnection.newCallStats();<a name="line.271"></a>
+<span class="sourceLineNo">272</span>      GenericFutureListener&lt;Future&lt;Message&gt;&gt; listener =<a name="line.272"></a>
+<span class="sourceLineNo">273</span>          new GenericFutureListener&lt;Future&lt;Message&gt;&gt;() {<a name="line.273"></a>
+<span class="sourceLineNo">274</span>            @Override<a name="line.274"></a>
+<span class="sourceLineNo">275</span>            public void operationComplete(Future&lt;Message&gt; future) throws Exception {<a name="line.275"></a>
+<span class="sourceLineNo">276</span>              cs.setCallTimeMs(EnvironmentEdgeManager.currentTime() - cs.getStartTime());<a name="line.276"></a>
+<span class="sourceLineNo">277</span>              if (metrics != null) {<a name="line.277"></a>
+<span class="sourceLineNo">278</span>                metrics.updateRpc(md, param, cs);<a name="line.278"></a>
+<span class="sourceLineNo">279</span>              }<a name="line.279"></a>
+<span class="sourceLineNo">280</span>              if (LOG.isTraceEnabled()) {<a name="line.280"></a>
+<span class="sourceLineNo">281</span>                LOG.trace("Call: " + md.getName() + ", callTime: " + cs.getCallTimeMs() + "ms");<a name="line.281"></a>
+<span class="sourceLineNo">282</span>              }<a name="line.282"></a>
+<span class="sourceLineNo">283</span>              if (!future.isSuccess()) {<a name="line.283"></a>
+<span class="sourceLineNo">284</span>                Throwable cause = future.cause();<a name="line.284"></a>
+<span class="sourceLineNo">285</span>                if (cause instanceof IOException) {<a name="line.285"></a>
+<span class="sourceLineNo">286</span>                  pcrc.setFailed((IOException) cause);<a name="line.286"></a>
+<span class="sourceLineNo">287</span>                } else {<a name="line.287"></a>
+<span class="sourceLineNo">288</span>                  pcrc.setFailed(new IOException(cause));<a name="line.288"></a>
+<span class="sourceLineNo">289</span>                }<a name="line.289"></a>
+<span class="sourceLineNo">290</span>              } else {<a name="line.290"></a>
+<span class="sourceLineNo">291</span>                try {<a name="line.291"></a>
+<span class="sourceLineNo">292</span>                  done.run(future.get());<a name="line.292"></a>
+<span class="sourceLineNo">293</span>                } catch (ExecutionException e) {<a name="line.293"></a>
+<span class="sourceLineNo">294</span>                  Throwable cause = e.getCause();<a name="line.294"></a>
+<span class="sourceLineNo">295</span>                  if (cause instanceof IOException) {<a name="line.295"></a>
+<span class="sourceLineNo">296</span>                    pcrc.setFailed((IOException) cause);<a name="line.296"></a>
+<span class="sourceLineNo">297</span>                  } else {<a name="line.297"></a>
+<span class="sourceLineNo">298</span>                    pcrc.setFailed(new IOException(cause));<a name="line.298"></a>
+<span class="sourceLineNo">299</span>                  }<a name="line.299"></a>
+<span class="sourceLineNo">300</span>                } catch (InterruptedException e) {<a name="line.300"></a>
+<span class="sourceLineNo">301</span>                  pcrc.setFailed(new IOException(e));<a name="line.301"></a>
+<span class="sourceLineNo">302</span>                }<a name="line.302"></a>
+<span class="sourceLineNo">303</span>              }<a name="line.303"></a>
+<span class="sourceLineNo">304</span>            }<a name="line.304"></a>
+<span class="sourceLineNo">305</span>          };<a name="line.305"></a>
+<span class="sourceLineNo">306</span>      cs.setStartTime(EnvironmentEdgeManager.currentTime());<a name="line.306"></a>
+<span class="sourceLineNo">307</span>      connection.callMethod(md, pcrc, param, returnType, cs).addListener(listener);<a name="line.307"></a>
+<span class="sourceLineNo">308</span>    } catch (StoppedRpcClientException|FailedServerException e) {<a name="line.308"></a>
+<span class="sourceLineNo">309</span>      pcrc.setFailed(e);<a name="line.309"></a>
+<span class="sourceLineNo">310</span>    }<a name="line.310"></a>
+<span class="sourceLineNo">311</span>  }<a name="line.311"></a>
+<span class="sourceLineNo">312</span><a name="line.312"></a>
+<span class="sourceLineNo">313</span>  private boolean closed = false;<a name="line.313"></a>
+<span class="sourceLineNo">314</span><a name="line.314"></a>
+<span class="sourceLineNo">315</span>  /**<a name="line.315"></a>
+<span class="sourceLineNo">316</span>   * Close netty<a name="line.316"></a>
+<span class="sourceLineNo">317</span>   */<a name="line.317"></a>
+<span class="sourceLineNo">318</span>  public void close() {<a name="line.318"></a>
+<span class="sourceLineNo">319</span>    if (LOG.isDebugEnabled()) {<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      LOG.debug("Stopping async HBase RPC client");<a name="line.320"></a>
+<span class="sourceLineNo">321</span>    }<a name="line.321"></a>
+<span class="sourceLineNo">322</span><a name="line.322"></a>
+<span class="sourceLineNo">323</span>    synchronized (connections) {<a name="line.323"></a>
+<span class="sourceLineNo">324</span>      if (closed) {<a name="line.324"></a>
+<span class="sourceLineNo">325</span>        return;<a name="line.325"></a>
+<span class="sourceLineNo">326</span>      }<a name="line.326"></a>
+<span class="sourceLineNo">327</span>      closed = true;<a name="line.327"></a>
+<span class="sourceLineNo">328</span>      for (AsyncRpcChannel conn : connections.values()) {<a name="line.328"></a>
+<span class="sourceLineNo">329</span>        conn.close(null);<a name="line.329"></a>
+<span class="sourceLineNo">330</span>      }<a name="line.330"></a>
+<span class="sourceLineNo">331</span>    }<a name="line.331"></a>
+<span class="sourceLineNo">332</span>    // do not close global EventLoopGroup.<a name="line.332"></a>
+<span class="sourceLineNo">333</span>    if (!useGlobalEventLoopGroup) {<a name="line.333"></a>
+<span class="sourceLineNo">334</span>      bootstrap.group().shutdownGracefully();<a name="line.334"></a>
+<span class="sourceLineNo">335</span>    }<a name="line.335"></a>
+<span class="sourceLineNo">336</span>  }<a name="line.336"></a>
+<span class="sourceLineNo">337</span><a name="line.337"></a>
+<span class="sourceLineNo">338</span>  /**<a name="line.338"></a>
+<span class="sourceLineNo">339</span>   * Create a cell scanner<a name="line.339"></a>
+<span class="sourceLineNo">340</span>   *<a name="line.340"></a>
+<span class="sourceLineNo">341</span>   * @param cellBlock to create scanner for<a name="line.341"></a>
+<span class="sourceLineNo">342</span>   * @return CellScanner<a name="line.342"></a>
+<span class="sourceLineNo">343</span>   * @throws java.io.IOException on error on creation cell scanner<a name="line.343"></a>
+<span class="sourceLineNo">344</span>   */<a name="line.344"></a>
+<span class="sourceLineNo">345</span>  public CellScanner createCellScanner(byte[] cellBlock) throws IOException {<a name="line.345"></a>
+<span class="sourceLineNo">346</span>    return ipcUtil.createCellScanner(this.codec, this.compressor, cellBlock);<a name="line.346"></a>
+<span class="sourceLineNo">347</span>  }<a name="line.347"></a>
+<span class="sourceLineNo">348</span><a name="line.348"></a>
+<span class="sourceLineNo">349</span>  /**<a name="line.349"></a>
+<span class="sourceLineNo">350</span>   * Build cell block<a name="line.350"></a>
+<span class="sourceLineNo">351</span>   *<a name="line.351"></a>
+<span class="sourceLineNo">352</span>   * @param cells to create block with<a name="line.352"></a>
+<span class="sourceLineNo">353</span>   * @return ByteBuffer with cells<a name="line.353"></a>
+<span class="sourceLineNo">354</span>   * @throws java.io.IOException if block creation fails<a name="line.354"></a>
+<span class="sourceLineNo">355</span>   */<a name="line.355"></a>
+<span class="sourceLineNo">356</span>  public ByteBuffer buildCellBlock(CellScanner cells) throws IOException {<a name="line.356"></a>
+<span class="sourceLineNo">357</span>    return ipcUtil.buildCellBlock(this.codec, this.compressor, cells);<a name="line.357"></a>
+<span class="sourceLineNo">358</span>  }<a name="line.358"></a>
+<span class="sourceLineNo">359</span><a name="line.359"></a>
+<span class="sourceLineNo">360</span>  /**<a name="line.360"></a>
+<span class="sourceLineNo">361</span>   * Creates an RPC client<a name="line.361"></a>
+<span class="sourceLineNo">362</span>   *<a name="line.362"></a>
+<span class="sourceLineNo">363</span>   * @param serviceName    name of servicce<a name="line.363"></a>
+<span class="sourceLineNo">364</span>   * @param location       to connect to<a name="line.364"></a>
+<span class="sourceLineNo">365</span>   * @param ticket         for current user<a name="line.365"></a>
+<span class="sourceLineNo">366</span>   * @return new RpcChannel<a name="line.366"></a>
+<span class="sourceLineNo">367</span>   * @throws StoppedRpcClientException when Rpc client is stopped<a name="line.367"></a>
+<span class="sourceLineNo">368</span>   * @throws FailedServerException if server failed<a name="line.368"></a>
+<span class="sourceLineNo">369</span>   */<a name="line.369"></a>
+<span class="sourceLineNo">370</span>  private AsyncRpcChannel createRpcChannel(String serviceName, InetSocketAddress location,<a name="line.370"></a>
+<span class="sourceLineNo">371</span>      User ticket) throws StoppedRpcClientException, FailedServerException {<a name="line.371"></a>
+<span class="sourceLineNo">372</span>    // Check if server is failed<a name="line.372"></a>
+<span class="sourceLineNo">373</span>    if (this.failedServers.isFailedServer(location)) {<a name="line.373"></a>
+<span class="sourceLineNo">374</span>      if (LOG.isDebugEnabled()) {<a name="line.374"></a>
+<span class="sourceLineNo">375</span>        LOG.debug("Not trying to connect to " + location +<a name="line.375"></a>
+<span class="sourceLineNo">376</span>            " this server is in the failed servers list");<a name="line.376"></a>
+<span class="sourceLineNo">377</span>      }<a name="line.377"></a>
+<span class="sourceLineNo">378</span>      throw new FailedServerException(<a name="line.378"></a>
+<span class="sourceLineNo">379</span>          "This server is in the failed servers list: " + location);<a name="line.379"></a>
+<span class="sourceLineNo">380</span>    }<a name="line.380"></a>
+<span class="sourceLineNo">381</span><a name="line.381"></a>
+<span class="sourceLineNo">382</span>    int hashCode = ConnectionId.hashCode(ticket,serviceName,location);<a name="line.382"></a>
+<span class="sourceLineNo">383</span><a name="line.383"></a>
+<span class="sourceLineNo">384</span>    AsyncRpcChannel rpcChannel;<a name="line.384"></a>
+<span class="sourceLineNo">385</span>    synchronized (connections) {<a name="line.385"></a>
+<span class="sourceLineNo">386</span>      if (closed) {<a name="line.386"></a>
+<span class="sourceLineNo">387</span>        throw new StoppedRpcClientException();<a name="line.387"></a>
+<span class="sourceLineNo">388</span>      }<a name="line.388"></a>
+<span class="sourceLineNo">389</span>      rpcChannel = connections.get(hashCode);<a name="line.389"></a>
+<span class="sourceLineNo">390</span>      if (rpcChannel != null &amp;&amp; !rpcChannel.isAlive()) {<a name="line.390"></a>
+<span class="sourceLineNo">391</span>        LOG.debug("Removing dead channel from server="+rpcChannel.address.toString());<a name="line.391"></a>
+<span class="sourceLineNo">392</span>        connections.remove(hashCode);<a name="line.392"></a>
+<span class="sourceLineNo">393</span>      }<a name="line.393"></a>
+<span class="sourceLineNo">394</span>      if (rpcChannel == null) {<a name="line.394"></a>
+<span class="sourceLineNo">395</span>        rpcChannel = new AsyncRpcChannel(this.bootstrap, this, ticket, serviceName, location);<a name="line.395"></a>
+<span class="sourceLineNo">396</span>        connections.put(hashCode, rpcChannel);<a name="line.396"></a>
+<span class="sourceLineNo">397</span>      }<a name="line.397"></a>
+<span class="sourceLineNo">398</span>    }<a name="line.398"></a>
+<span class="sourceLineNo">399</span><a name="line.399"></a>
+<span class="sourceLineNo">400</span>    return rpcChannel;<a name="line.400"></a>
+<span class="sourceLineNo">401</span>  }<a name="line.401"></a>
+<span class="sourceLineNo">402</span><a name="line.402"></a>
+<span class="sourceLineNo">403</span>  /**<a name="line.403"></a>
+<span class="sourceLineNo">404</span>   * Interrupt the connections to the given ip:port server. This should be called if the server<a name="line.404"></a>
+<span class="sourceLineNo">405</span>   * is known as actually dead. This will not prevent current operation to be retried, and,<a name="line.405"></a>
+<span class="sourceLineNo">406</span>   * depending on their own behavior, they may retry on the same server. This can be a feature,<a name="line.406"></a>
+<span class="sourceLineNo">407</span>   * for example at startup. In any case, they're likely to get connection refused (if the<a name="line.407"></a>
+<span class="sourceLineNo">408</span>   * process died) or no route to host: i.e. there next retries should be faster and with a<a name="line.408"></a>
+<span class="sourceLineNo">409</span>   * safe exception.<a name="line.409"></a>
+<span class="sourceLineNo">410</span>   *<a name="line.410"></a>
+<span class="sourceLineNo">411</span>   * @param sn server to cancel connections for<a name="line.411"></a>
+<span class="sourceLineNo">412</span>   */<a name="line.412"></a>
+<span class="sourceLineNo">413</span>  @Override<a name="line.413"></a>
+<span class="sourceLineNo">414</span>  public void cancelConnections(ServerName sn) {<a name="line.414"></a>
+<span class="sourceLineNo">415</span>    synchronized (connections) {<a name="line.415"></a>
+<span class="sourceLineNo">416</span>      for (AsyncRpcChannel rpcChannel : connections.values()) {<a name="line.416"></a>
+<span class="sourceLineNo">417</span>        if (rpcChannel.isAlive() &amp;&amp;<a name="line.417"></a>
+<span class="sourceLineNo">418</span>            rpcChannel.address.getPort() == sn.getPort() &amp;&amp;<a name="line.418"></a>
+<span class="sourceLineNo">419</span>            rpcChannel.address.getHostName().contentEquals(sn.getHostname())) {<a name="line.419"></a>
+<span class="sourceLineNo">420</span>          LOG.info("The server on " + sn.toString() +<a name="line.420"></a>
+<span class="sourceLineNo">421</span>              " is dead - stopping the connection " + rpcChannel.toString());<a name="line.421"></a>
+<span class="sourceLineNo">422</span>          rpcChannel.close(null);<a name="line.422"></a>
+<span class="sourceLineNo">423</span>        }<a name="line.423"></a>
+<span class="sourceLineNo">424</span>      }<a name="line.424"></a>
+<span class="sourceLineNo">425</span>    }<a name="line.425"></a>
+<span class="sourceLineNo">426</span>  }<a name="line.426"></a>
+<span class="sourceLineNo">427</span><a name="line.427"></a>
+<span class="sourceLineNo">428</span>  /**<a name="line.428"></a>
+<span class="sourceLineNo">429</span>   * Remove connection from pool<a name="line.429"></a>
+<span class="sourceLineNo">430</span>   */<a name="line.430"></a>
+<span class="sourceLineNo">431</span>  public void removeConnection(AsyncRpcChannel connection) {<a name="line.431"></a>
+<span class="sourceLineNo">432</span>    int connectionHashCode = connection.hashCode();<a name="line.432"></a>
+<span class="sourceLineNo">433</span>    synchronized (connections) {<a name="line.433"></a>
+<span class="sourceLineNo">434</span>      // we use address as cache key, so we should check here to prevent removing the<a name="line.434"></a>
+<span class="sourceLineNo">435</span>      // wrong connection<a name="line.435"></a>
+<span class="sourceLineNo">436</span>      AsyncRpcChannel connectionInPool = this.connections.get(connectionHashCode);<a name="line.436"></a>
+<span class="sourceLineNo">437</span>      if (connectionInPool != null &amp;&amp; connectionInPool.equals(connection)) {<a name="line.437"></a>
+<span class="sourceLineNo">438</span>        this.connections.remove(connectionHashCode);<a name="line.438"></a>
+<span class="sourceLineNo">439</span>      } else if (LOG.isDebugEnabled()) {<a name="line.439"></a>
+<span class="sourceLineNo">440</span>        LOG.debug(String.format("%s already removed, expected instance %08x, actual %08x",<a name="line.440"></a>
+<span class="sourceLineNo">441</span>          connection.toString(), System.identityHashCode(connection),<a name="line.441"></a>
+<span class="sourceLineNo">442</span>          System.identityHashCode(connectionInPool)));<a name="line.442"></a>
+<span class="sourceLineNo">443</span>      }<a name="line.443"></a>
+<span class="sourceLineNo">444</span>    }<a name="line.444"></a>
+<span class="sourceLineNo">445</span>  }<a name="line.445"></a>
+<span class="sourceLineNo">446</span><a name="line.446"></a>
+<span class="sourceLineNo">447</span>  /**<a name="line.447"></a>
+<span class="sourceLineNo">448</span>   * Creates a "channel" that can be used by a protobuf service.  Useful setting up<a name="line.448"></a>
+<span class="sourceLineNo">449</span>   * protobuf stubs.<a name="line.449"></a>
+<span class="sourceLineNo">450</span>   *<a name="line.450"></a>
+<span class="sourceLineNo">451</span>   * @param sn server name describing location of server<a name="line.451"></a>
+<span class="sourceLineNo">452</span>   * @param user which is to use the connection<a name="line.452"></a>
+<span class="sourceLineNo">453</span>   * @param rpcTimeout default rpc operation timeout<a name="line.453"></a>
+<span class="sourceLineNo">454</span>   *<a name="line.454"></a>
+<span class="sourceLineNo">455</span>   * @return A rpc channel that goes via this rpc client instance.<a name="line.455"></a>
+<span class="sourceLineNo">456</span>   */<a name="line.456"></a>
+<span class="sourceLineNo">457</span>  public RpcChannel createRpcChannel(final ServerName sn, final User user, int rpcTimeout) {<a name="line.457"></a>
+<span class="sourceLineNo">458</span>    return new RpcChannelImplementation(this, sn, user, rpcTimeout);<a name="line.458"></a>
+<span class="sourceLineNo">459</span>  }<a name="line.459"></a>
+<span class="sourceLineNo">460</span><a name="line.460"></a>
+<span class="sourceLineNo">461</span>  /**<a name="line.461"></a>
+<span class="sourceLineNo">462</span>   * Blocking rpc channel that goes via hbase rpc.<a name="line.462"></a>
+<span class="sourceLineNo">463</span>   */<a name="line.463"></a>
+<span class="sourceLineNo">464</span>  @VisibleForTesting<a name="line.464"></a>
+<span class="sourceLineNo">465</span>  public static class RpcChannelImplementation implements RpcChannel {<a name="line.465"></a>
+<span class="sourceLineNo">466</span>    private final InetSocketAddress isa;<a name="line.466"></a>
+<span class="sourceLineNo">467</span>    private final AsyncRpcClient rpcClient;<a name="line.467"></a>
+<span class="sourceLineNo">468</span>    private final User ticket;<a name="line.468"></a>
+<span class="sourceLineNo">469</span>    private final int channelOperationTimeout;<a name="line.469"></a>
+<span class="sourceLineNo">470</span><a name="line.470"></a>
+<span class="sourceLineNo">471</span>    /**<a name="line.471"></a>
+<span class="sourceLineNo">472</span>     * @param channelOperationTimeout - the default timeout when no timeout is given<a name="line.472"></a>
+<span class="sourceLineNo">473</span>     */<a name="line.473"></a>
+<span class="sourceLineNo">474</span>    protected RpcChannelImplementation(final AsyncRpcClient rpcClient,<a name="line.474"></a>
+<span class="sourceLineNo">475</span>        final ServerName sn, final User ticket, int channelOperationTimeout) {<a name="line.475"></a>
+<span class="sourceLineNo">476</span>      this.isa = new InetSocketAddress(sn.getHostname(), sn.getPort());<a name="line.476"></a>
+<span class="sourceLineNo">477</span>      this.rpcClient = rpcClient;<a name="line.477"></a>
+<span class="sourceLineNo">478</span>      this.ticket = ticket;<a name="line.478"></a>
+<span class="sourceLineNo">479</span>      this.channelOperationTimeout = channelOperationTimeout;<a name="line.479"></a>
+<span class="sourceLineNo">480</span>    }<a name="line.480"></a>
+<span class="sourceLineNo">481</span><a name="line.481"></a>
+<span class="sourceLineNo">482</span>    @Override<a name="line.482"></a>
+<span class="sourceLineNo">483</span>    public void callMethod(Descriptors.MethodDescriptor md, RpcController controller,<a name="line.483"></a>
+<span class="sourceLineNo">484</span>        Message param, Message returnType, RpcCallback&lt;Message&gt; done) {<a name="line.484"></a>
+<span class="sourceLineNo">485</span>      PayloadCarryingRpcController pcrc;<a name="line.485"></a>
+<span class="sourceLineNo">486</span>      if (controller != null) {<a name="line.486"></a>
+<span class="sourceLineNo">487</span>        pcrc = (PayloadCarryingRpcController) controller;<a name="line.487"></a>
+<span class="sourceLineNo">488</span>        if (!pcrc.hasCallTimeout()) {<a name="line.488"></a>
+<span class="sourceLineNo">489</span>          pcrc.setCallTimeout(channelOperationTimeout);<a name="line.489"></a>
+<span class="sourceLineNo">490</span>        }<a name="line.490"></a>
+<span class="sourceLineNo">491</span>      } else {<a name="line.491"></a>
+<span class="sourceLineNo">492</span>        pcrc = new PayloadCarryingRpcController();<a name="line.492"></a>
+<span class="sourceLineNo">493</span>        pcrc.setCallTimeout(channelOperationTimeout);<a name="line.493"></a>
+<span class="sourceLineNo">494</span>      }<a name="line.494"></a>
+<span class="sourceLineNo">495</span><a name="line.495"></a>
+<span class="sourceLineNo">496</span>      this.rpcClient.callMethod(md, pcrc, param, returnType, this.ticket, this.isa, done);<a name="line.496"></a>
+<span class="sourceLineNo">497</span>    }<a name="line.497"></a>
+<span class="sourceLineNo">498</span>  }<a name="line.498"></a>
+<span class="sourceLineNo">499</span><a name="line.499"></a>
+<span class="sourceLineNo">500</span>  Timeout newTimeout(TimerTask task, long delay, TimeUnit unit) {<a name="line.500"></a>
+<span class="sourceLineNo">501</span>    return WHEEL_TIMER.newTimeout(task, delay, unit);<a name="line.501"></a>
+<span class="sourceLineNo">502</span>  }<a name="line.502"></a>
+<span class="sourceLineNo">503</span>}<a name="line.503"></a>
 
 
 


Mime
View raw message