@InterfaceAudience.Private class SchemaLocking extends Object
Locks on namespaces, tables, and regions.
Since LockAndQueue implementation is NOT thread-safe, schedLock() guards all calls to these locks.
Modifier and Type | Field and Description |
---|---|
private LockAndQueue |
metaLock |
private Map<String,LockAndQueue> |
namespaceLocks |
private Map<String,LockAndQueue> |
peerLocks |
private Function<Long,Procedure<?>> |
procedureRetriever |
private Map<String,LockAndQueue> |
regionLocks |
private Map<ServerName,LockAndQueue> |
serverLocks |
private Map<TableName,LockAndQueue> |
tableLocks |
Constructor and Description |
---|
SchemaLocking(Function<Long,Procedure<?>> procedureRetriever) |
Modifier and Type | Method and Description |
---|---|
private <T> void |
addToLockedResources(List<LockedResource> lockedResources,
Map<T,LockAndQueue> locks,
Function<T,String> keyTransformer,
LockedResourceType resourcesType) |
(package private) void |
clear()
Removes all locks by clearing the maps.
|
private LockedResource |
createLockedResource(LockedResourceType resourceType,
String resourceName,
LockAndQueue queue) |
private String |
filterUnlocked(Map<?,LockAndQueue> locks) |
private <T> LockAndQueue |
getLock(Map<T,LockAndQueue> map,
T key) |
(package private) LockedResource |
getLockResource(LockedResourceType resourceType,
String resourceName) |
(package private) List<LockedResource> |
getLocks()
List lock queues.
|
(package private) LockAndQueue |
getMetaLock()
Deprecated.
only used for
RecoverMetaProcedure . Should be removed along with
RecoverMetaProcedure . |
(package private) LockAndQueue |
getNamespaceLock(String namespace) |
(package private) LockAndQueue |
getPeerLock(String peerId) |
(package private) LockAndQueue |
getRegionLock(String encodedRegionName) |
(package private) LockAndQueue |
getServerLock(ServerName serverName) |
(package private) LockAndQueue |
getTableLock(TableName tableName) |
(package private) LockAndQueue |
removePeerLock(String peerId) |
(package private) LockAndQueue |
removeRegionLock(String encodedRegionName) |
(package private) LockAndQueue |
removeServerLock(ServerName serverName) |
(package private) LockAndQueue |
removeTableLock(TableName tableName) |
String |
toString() |
private final Function<Long,Procedure<?>> procedureRetriever
private final Map<ServerName,LockAndQueue> serverLocks
private final Map<String,LockAndQueue> namespaceLocks
private final Map<TableName,LockAndQueue> tableLocks
private final Map<String,LockAndQueue> regionLocks
private final Map<String,LockAndQueue> peerLocks
private final LockAndQueue metaLock
public SchemaLocking(Function<Long,Procedure<?>> procedureRetriever)
private <T> LockAndQueue getLock(Map<T,LockAndQueue> map, T key)
LockAndQueue getTableLock(TableName tableName)
LockAndQueue removeTableLock(TableName tableName)
LockAndQueue getNamespaceLock(String namespace)
LockAndQueue getRegionLock(String encodedRegionName)
@Deprecated LockAndQueue getMetaLock()
RecoverMetaProcedure
. Should be removed along with
RecoverMetaProcedure
.LockAndQueue removeRegionLock(String encodedRegionName)
LockAndQueue getServerLock(ServerName serverName)
LockAndQueue removeServerLock(ServerName serverName)
LockAndQueue getPeerLock(String peerId)
LockAndQueue removePeerLock(String peerId)
private LockedResource createLockedResource(LockedResourceType resourceType, String resourceName, LockAndQueue queue)
private <T> void addToLockedResources(List<LockedResource> lockedResources, Map<T,LockAndQueue> locks, Function<T,String> keyTransformer, LockedResourceType resourcesType)
List<LockedResource> getLocks()
LockedResource getLockResource(LockedResourceType resourceType, String resourceName)
LockedResource
for resource of specified type & name. null if resource is not
locked.void clear()
private String filterUnlocked(Map<?,LockAndQueue> locks)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.