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:
parent
b970e4b0d9
commit
24131743a8
|
@ -119,7 +119,7 @@ public class HBaseAdmin implements Abortable, Closeable {
|
||||||
|
|
||||||
// We use the implementation class rather then the interface because we
|
// We use the implementation class rather then the interface because we
|
||||||
// need the package protected functions to get the connection to master
|
// need the package protected functions to get the connection to master
|
||||||
private HConnectionManager.HConnectionImplementation connection;
|
private HConnection connection;
|
||||||
|
|
||||||
private volatile Configuration conf;
|
private volatile Configuration conf;
|
||||||
private final long pause;
|
private final long pause;
|
||||||
|
@ -154,10 +154,7 @@ public class HBaseAdmin implements Abortable, Closeable {
|
||||||
public HBaseAdmin(HConnection connection)
|
public HBaseAdmin(HConnection connection)
|
||||||
throws MasterNotRunningException, ZooKeeperConnectionException {
|
throws MasterNotRunningException, ZooKeeperConnectionException {
|
||||||
this.conf = connection.getConfiguration();
|
this.conf = connection.getConfiguration();
|
||||||
|
this.connection = connection;
|
||||||
// We want the real class, without showing it our public interface,
|
|
||||||
// hence the cast.
|
|
||||||
this.connection = (HConnectionManager.HConnectionImplementation)connection;
|
|
||||||
|
|
||||||
this.pause = this.conf.getLong("hbase.client.pause", 1000);
|
this.pause = this.conf.getLong("hbase.client.pause", 1000);
|
||||||
this.numRetries = this.conf.getInt("hbase.client.retries.number", 10);
|
this.numRetries = this.conf.getInt("hbase.client.retries.number", 10);
|
||||||
|
|
|
@ -387,5 +387,22 @@ public interface HConnection extends Abortable, Closeable {
|
||||||
* @param sn A server name as hostname:port
|
* @param sn A server name as hostname:port
|
||||||
*/
|
*/
|
||||||
public void clearCaches(final String sn);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1617,26 +1617,16 @@ public class HConnectionManager {
|
||||||
return getKeepAliveMasterMonitor();
|
return getKeepAliveMasterMonitor();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* This function allows HBaseAdmin and potentially others
|
public MasterAdminKeepAliveConnection getKeepAliveMasterAdmin()
|
||||||
* to get a shared MasterAdminProtocol connection.
|
throws MasterNotRunningException {
|
||||||
*
|
|
||||||
* @return The shared instance. Never returns null.
|
|
||||||
* @throws MasterNotRunningException
|
|
||||||
*/
|
|
||||||
MasterAdminKeepAliveConnection getKeepAliveMasterAdmin() throws MasterNotRunningException {
|
|
||||||
return (MasterAdminKeepAliveConnection)
|
return (MasterAdminKeepAliveConnection)
|
||||||
getKeepAliveMasterProtocol(masterAdminProtocol, MasterAdminKeepAliveConnection.class);
|
getKeepAliveMasterProtocol(masterAdminProtocol, MasterAdminKeepAliveConnection.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* This function allows HBaseAdminProtocol and potentially others
|
public MasterMonitorKeepAliveConnection getKeepAliveMasterMonitor()
|
||||||
* to get a shared MasterMonitor connection.
|
throws MasterNotRunningException {
|
||||||
*
|
|
||||||
* @return The shared instance. Never returns null.
|
|
||||||
* @throws MasterNotRunningException
|
|
||||||
*/
|
|
||||||
MasterMonitorKeepAliveConnection getKeepAliveMasterMonitor() throws MasterNotRunningException {
|
|
||||||
return (MasterMonitorKeepAliveConnection)
|
return (MasterMonitorKeepAliveConnection)
|
||||||
getKeepAliveMasterProtocol(masterMonitorProtocol, MasterMonitorKeepAliveConnection.class);
|
getKeepAliveMasterProtocol(masterMonitorProtocol, MasterMonitorKeepAliveConnection.class);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue