[ 
https://issues.apache.org/jira/browse/HBASE-16445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15447973#comment-15447973
 ] 

Duo Zhang commented on HBASE-16445:
-----------------------------------

Oh sorry, I missed something... too many changes...

As said above, get connection and send request are not protected under a lock, 
so it is not safe to remove connection from pool directly when connection 
failed or something else. This could happen
  1. User get a connection
  2. The connection itself fails to connect to remote side, close and remove 
itself from pool.
  3. User tries to send request with this connection.

Instead, I make the connection always reconnectable. And also, idle connection 
can only be removed by a task in AbstractRpcClient. The task will check the 
last touched time of a connection under the protection of connections lock, so 
ideally the removed connection will not be used by anyone(unless the idle time 
is too small...).

And also, for timeout, the HashedWheelTimer is enough, it is a background task 
that triggers timeout, so we do not need to change so_timeout every time when 
reading from socket.

Thanks.

> Refactor and reimplement RpcClient
> ----------------------------------
>
>                 Key: HBASE-16445
>                 URL: https://issues.apache.org/jira/browse/HBASE-16445
>             Project: HBase
>          Issue Type: Sub-task
>    Affects Versions: 2.0.0
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>             Fix For: 2.0.0
>
>         Attachments: HBASE-16445-v1.patch, HBASE-16445.patch
>
>
> There are lots of common logics between RpcClientImpl and AsyncRpcClient. We 
> should have much less code comparing to the current implementations.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to