@InterfaceAudience.Private @InterfaceStability.Evolving public class QuotaCache extends Object implements Stoppable
Modifier and Type | Class and Description |
---|---|
(package private) static interface |
QuotaCache.Fetcher<Key,Value> |
private class |
QuotaCache.QuotaRefresherChore |
Modifier and Type | Field and Description |
---|---|
private static int |
EVICT_PERIOD_FACTOR |
private boolean |
exceedThrottleQuotaEnabled |
private static org.slf4j.Logger |
LOG |
private double |
machineQuotaFactor |
private ConcurrentHashMap<String,QuotaState> |
namespaceQuotaCache |
static String |
REFRESH_CONF_KEY |
private static int |
REFRESH_DEFAULT_PERIOD |
private QuotaCache.QuotaRefresherChore |
refreshChore |
private ConcurrentHashMap<String,QuotaState> |
regionServerQuotaCache |
private RegionServerServices |
rsServices |
private boolean |
stopped |
private ConcurrentHashMap<TableName,Double> |
tableMachineQuotaFactors |
private ConcurrentHashMap<TableName,QuotaState> |
tableQuotaCache |
(package private) static boolean |
TEST_FORCE_REFRESH |
private ConcurrentHashMap<String,UserQuotaState> |
userQuotaCache |
Constructor and Description |
---|
QuotaCache(RegionServerServices rsServices) |
Modifier and Type | Method and Description |
---|---|
(package private) long |
getLastUpdate() |
QuotaLimiter |
getNamespaceLimiter(String namespace)
Returns the limiter associated to the specified namespace.
|
(package private) Map<String,QuotaState> |
getNamespaceQuotaCache() |
private <K> QuotaState |
getQuotaState(ConcurrentHashMap<K,QuotaState> quotasMap,
K key)
Returns the QuotaState requested.
|
(package private) Map<String,QuotaState> |
getRegionServerQuotaCache() |
QuotaLimiter |
getRegionServerQuotaLimiter(String regionServer)
Returns the limiter associated to the specified region server.
|
QuotaLimiter |
getTableLimiter(TableName table)
Returns the limiter associated to the specified table.
|
(package private) Map<TableName,QuotaState> |
getTableQuotaCache() |
QuotaLimiter |
getUserLimiter(org.apache.hadoop.security.UserGroupInformation ugi,
TableName table)
Returns the limiter associated to the specified user/table.
|
(package private) Map<String,UserQuotaState> |
getUserQuotaCache() |
UserQuotaState |
getUserQuotaState(org.apache.hadoop.security.UserGroupInformation ugi)
Returns the QuotaState associated to the specified user.
|
protected boolean |
isExceedThrottleQuotaEnabled() |
boolean |
isStopped()
Returns True if
Stoppable.stop(String) has been closed. |
void |
start() |
void |
stop(String why)
Stop this service.
|
(package private) void |
triggerCacheRefresh() |
private static final org.slf4j.Logger LOG
public static final String REFRESH_CONF_KEY
private static final int REFRESH_DEFAULT_PERIOD
private static final int EVICT_PERIOD_FACTOR
static boolean TEST_FORCE_REFRESH
private final ConcurrentHashMap<String,QuotaState> namespaceQuotaCache
private final ConcurrentHashMap<TableName,QuotaState> tableQuotaCache
private final ConcurrentHashMap<String,UserQuotaState> userQuotaCache
private final ConcurrentHashMap<String,QuotaState> regionServerQuotaCache
private volatile boolean exceedThrottleQuotaEnabled
private volatile double machineQuotaFactor
private final ConcurrentHashMap<TableName,Double> tableMachineQuotaFactors
private final RegionServerServices rsServices
private QuotaCache.QuotaRefresherChore refreshChore
private boolean stopped
public QuotaCache(RegionServerServices rsServices)
public void start() throws IOException
IOException
public void stop(String why)
Stoppable
public boolean isStopped()
Stoppable
Stoppable.stop(String)
has been closed.public QuotaLimiter getUserLimiter(org.apache.hadoop.security.UserGroupInformation ugi, TableName table)
ugi
- the user to limittable
- the table to limitpublic UserQuotaState getUserQuotaState(org.apache.hadoop.security.UserGroupInformation ugi)
ugi
- the userpublic QuotaLimiter getTableLimiter(TableName table)
table
- the table to limitpublic QuotaLimiter getNamespaceLimiter(String namespace)
namespace
- the namespace to limitpublic QuotaLimiter getRegionServerQuotaLimiter(String regionServer)
regionServer
- the region server to limitprotected boolean isExceedThrottleQuotaEnabled()
private <K> QuotaState getQuotaState(ConcurrentHashMap<K,QuotaState> quotasMap, K key)
void triggerCacheRefresh()
long getLastUpdate()
Map<String,QuotaState> getNamespaceQuotaCache()
Map<String,QuotaState> getRegionServerQuotaCache()
Map<TableName,QuotaState> getTableQuotaCache()
Map<String,UserQuotaState> getUserQuotaCache()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.