@InterfaceAudience.Private public class ConnectionCache extends Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
ConnectionCache.ConnectionInfo |
Modifier and Type | Field and Description |
---|---|
private ChoreService |
choreService |
private org.apache.hadoop.conf.Configuration |
conf |
private Map<String,ConnectionCache.ConnectionInfo> |
connections |
private ThreadLocal<String> |
effectiveUserNames |
private KeyLocker<String> |
locker |
private static org.slf4j.Logger |
LOG |
private org.apache.hadoop.security.UserGroupInformation |
realUser |
private String |
realUserName |
private UserProvider |
userProvider |
Constructor and Description |
---|
ConnectionCache(org.apache.hadoop.conf.Configuration conf,
UserProvider userProvider,
int cleanInterval,
int maxIdleTime) |
Modifier and Type | Method and Description |
---|---|
Admin |
getAdmin()
Caller doesn't close the admin afterwards.
|
String |
getClusterId()
Returns Cluster ID for the HBase cluster or null if there is an err making the connection.
|
(package private) ConnectionCache.ConnectionInfo |
getCurrentConnection()
Get the cached connection for the current user.
|
String |
getEffectiveUser()
Get the current thread local effective user
|
RegionLocator |
getRegionLocator(byte[] tableName)
Retrieve a regionLocator for the table.
|
Table |
getTable(String tableName)
Caller closes the table afterwards.
|
void |
setEffectiveUser(String user)
Set the current thread local effective user
|
void |
shutdown()
Called when cache is no longer needed so that it can perform cleanup operations
|
boolean |
updateConnectionAccessTime()
Updates the access time for the current connection.
|
private static final org.slf4j.Logger LOG
private final Map<String,ConnectionCache.ConnectionInfo> connections
private final String realUserName
private final org.apache.hadoop.security.UserGroupInformation realUser
private final UserProvider userProvider
private final org.apache.hadoop.conf.Configuration conf
private final ChoreService choreService
private final ThreadLocal<String> effectiveUserNames
public ConnectionCache(org.apache.hadoop.conf.Configuration conf, UserProvider userProvider, int cleanInterval, int maxIdleTime) throws IOException
IOException
public void setEffectiveUser(String user)
public String getEffectiveUser()
public void shutdown()
public Admin getAdmin() throws IOException
IOException
public Table getTable(String tableName) throws IOException
IOException
public RegionLocator getRegionLocator(byte[] tableName) throws IOException
IOException
ConnectionCache.ConnectionInfo getCurrentConnection() throws IOException
IOException
public boolean updateConnectionAccessTime()
public String getClusterId()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.