HBASE-13664 Use HBase 1.0 interfaces in ConnectionCache (Solomon Duskis)
This commit is contained in:
parent
8e8e246248
commit
e42e7ed110
|
@ -30,10 +30,10 @@ import org.apache.hadoop.hbase.Stoppable;
|
|||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.client.Admin;
|
||||
import org.apache.hadoop.hbase.client.HConnection;
|
||||
import org.apache.hadoop.hbase.client.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.client.HTableInterface;
|
||||
import org.apache.hadoop.hbase.client.Connection;
|
||||
import org.apache.hadoop.hbase.client.ConnectionFactory;
|
||||
import org.apache.hadoop.hbase.client.RegionLocator;
|
||||
import org.apache.hadoop.hbase.client.Table;
|
||||
import org.apache.hadoop.hbase.security.User;
|
||||
import org.apache.hadoop.hbase.security.UserProvider;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
|
@ -147,9 +147,9 @@ public class ConnectionCache {
|
|||
/**
|
||||
* Caller closes the table afterwards.
|
||||
*/
|
||||
public HTableInterface getTable(String tableName) throws IOException {
|
||||
public Table getTable(String tableName) throws IOException {
|
||||
ConnectionInfo connInfo = getCurrentConnection();
|
||||
return connInfo.connection.getTable(tableName);
|
||||
return connInfo.connection.getTable(TableName.valueOf(tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,7 +176,7 @@ public class ConnectionCache {
|
|||
ugi = UserGroupInformation.createProxyUser(userName, realUser);
|
||||
}
|
||||
User user = userProvider.create(ugi);
|
||||
HConnection conn = HConnectionManager.createConnection(conf, user);
|
||||
Connection conn = ConnectionFactory.createConnection(conf, user);
|
||||
connInfo = new ConnectionInfo(conn, userName);
|
||||
connections.put(userName, connInfo);
|
||||
}
|
||||
|
@ -188,14 +188,14 @@ public class ConnectionCache {
|
|||
}
|
||||
|
||||
class ConnectionInfo {
|
||||
final HConnection connection;
|
||||
final Connection connection;
|
||||
final String userName;
|
||||
|
||||
volatile Admin admin;
|
||||
private long lastAccessTime;
|
||||
private boolean closed;
|
||||
|
||||
ConnectionInfo(HConnection conn, String user) {
|
||||
ConnectionInfo(Connection conn, String user) {
|
||||
lastAccessTime = EnvironmentEdgeManager.currentTime();
|
||||
connection = conn;
|
||||
closed = false;
|
||||
|
|
Loading…
Reference in New Issue