diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index 2547d52..91a3155 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -120,7 +120,7 @@ public class HBaseAdmin implements Abortable, Closeable { // We use the implementation class rather then the interface because we // need the package protected functions to get the connection to master - private HConnectionManager.HConnectionImplementation connection; + private HConnection connection; private volatile Configuration conf; private final long pause; @@ -155,10 +155,7 @@ public class HBaseAdmin implements Abortable, Closeable { public HBaseAdmin(HConnection connection) throws MasterNotRunningException, ZooKeeperConnectionException { this.conf = connection.getConfiguration(); - - // We want the real class, without showing it our public interface, - // hence the cast. - this.connection = (HConnectionManager.HConnectionImplementation)connection; + this.connection = connection; this.pause = this.conf.getLong("hbase.client.pause", 1000); this.numRetries = this.conf.getInt("hbase.client.retries.number", 10); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java index b623bc2..7b13523 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnection.java @@ -388,5 +388,22 @@ public interface HConnection extends Abortable, Closeable { * @param sn A server name as hostname:port */ public void clearCaches(final String sn); + + /** + * This function allows HBaseAdminProtocol and potentially others to get a shared MasterMonitor + * connection. + * @return The shared instance. Never returns null. + * @throws MasterNotRunningException + */ + public MasterMonitorKeepAliveConnection getKeepAliveMasterMonitor() + throws MasterNotRunningException; + + /** + * This function allows HBaseAdmin and potentially others to get a shared MasterAdminProtocol + * connection. + * @return The shared instance. Never returns null. + * @throws MasterNotRunningException + */ + public MasterAdminKeepAliveConnection getKeepAliveMasterAdmin() throws MasterNotRunningException; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java index 62c5b18..f94cecc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java @@ -1618,26 +1618,16 @@ public class HConnectionManager { return getKeepAliveMasterMonitor(); } - /** - * This function allows HBaseAdmin and potentially others - * to get a shared MasterAdminProtocol connection. - * - * @return The shared instance. Never returns null. - * @throws MasterNotRunningException - */ - MasterAdminKeepAliveConnection getKeepAliveMasterAdmin() throws MasterNotRunningException { + @Override + public MasterAdminKeepAliveConnection getKeepAliveMasterAdmin() + throws MasterNotRunningException { return (MasterAdminKeepAliveConnection) getKeepAliveMasterProtocol(masterAdminProtocol, MasterAdminKeepAliveConnection.class); } - /** - * This function allows HBaseAdminProtocol and potentially others - * to get a shared MasterMonitor connection. - * - * @return The shared instance. Never returns null. - * @throws MasterNotRunningException - */ - MasterMonitorKeepAliveConnection getKeepAliveMasterMonitor() throws MasterNotRunningException { + @Override + public MasterMonitorKeepAliveConnection getKeepAliveMasterMonitor() + throws MasterNotRunningException { return (MasterMonitorKeepAliveConnection) getKeepAliveMasterProtocol(masterMonitorProtocol, MasterMonitorKeepAliveConnection.class); }