HBASE-6495 HBaseAdmin shouldn't expect HConnection to be an HConnectionImplementation

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1381467 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2012-09-06 05:01:01 +00:00
parent b970e4b0d9
commit 24131743a8
3 changed files with 25 additions and 21 deletions

View File

@ -119,7 +119,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;
@ -154,10 +154,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);

View File

@ -387,5 +387,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;
}

View File

@ -1617,26 +1617,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);
}