[
https://issues.apache.org/jira/browse/HBASE-21724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16743534#comment-16743534
]
Duo Zhang commented on HBASE-21724:
-----------------------------------
https://github.com/Apache9/hbase/blob/HBASE-21585/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ClusterConnection.java
This is what I have done so far to clean up the ClusterConnection interface,
most methods can be removed. And the intention here is that, use
ConnectionImplementation directly in the client library instead of
ClusterConnection.
This is what we have done in the async client implementation. The
AsyncConnection interface is very clean, just like the Connection interface,
and we do not have an AsyncClusterConnection in the client module, instead, all
the related classes will use AsyncConnectionImpl directly, so you can get the
protobuf stubs, the retrying callers, and everything you want.
I think this is a common philosophy in software design, high cohesion and low
coupling. The AsyncConnectionImpl is package private, so in other module you
are not allowed to access it directly, you must use the methods in
AsyncConnection to do what you want. So in the future, if we find another good
framework and want to reimplement the client, we can just reimplement the
AsyncConnection interface and remove the old implementation completely, as we
do not leak any internal things out.
So I want to apply the same pattern to the current sync client implementation.
The on-going replacement work of the sync client is really a pain, as we leak
everything out, the protobuf stubs and retrying callers are used everywhere in
different modules and different packages. Hope we do not need to do the clean
up work again in the future when we want to introduce a new client
implementation...
> Introduce a createClusterConnection method in ClusterConnectionFactory
> ----------------------------------------------------------------------
>
> Key: HBASE-21724
> URL: https://issues.apache.org/jira/browse/HBASE-21724
> Project: HBase
> Issue Type: Sub-task
> Reporter: Duo Zhang
> Priority: Major
>
> When we want a cluster connection in the code, we should use this method to
> create one directly, instead of casting the one created by ConnectionFactory.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)