Class LockManager.MasterLock
java.lang.Object
org.apache.hadoop.hbase.master.locking.LockManager.MasterLock
- Enclosing class:
- LockManager
Locks on namespace/table/regions. Underneath, uses procedure framework and queues a
LockProcedure
which waits in a queue until scheduled. Use this lock instead
LockManager.remoteLocks() for MASTER ONLY operations for two advantages: - no need of polling
on LockProcedure to check if lock was acquired. - Generous timeout for lock preemption (default
10 min), no need to spawn thread for heartbeats. (timeout configuration
LockProcedure.DEFAULT_LOCAL_MASTER_LOCKS_TIMEOUT_MS
).-
Field Summary
Modifier and TypeFieldDescriptionprivate final String
private final String
private LockProcedure
private final RegionInfo[]
private final TableName
private final LockType
-
Constructor Summary
ConstructorDescriptionMasterLock
(String namespace, LockType type, String description) MasterLock
(RegionInfo[] regionInfos, String description) MasterLock
(TableName tableName, LockType type, String description) -
Method Summary
Modifier and TypeMethodDescription(package private) LockProcedure
getProc()
void
release()
Release the lock.toString()
boolean
tryAcquire
(long timeoutMs) Acquire the lock within a wait time.
-
Field Details
-
namespace
-
tableName
-
regionInfos
-
type
-
description
-
proc
-
-
Constructor Details
-
MasterLock
-
MasterLock
-
MasterLock
-
-
Method Details
-
tryAcquire
Acquire the lock within a wait time.- Parameters:
timeoutMs
- The maximum time (in milliseconds) to wait for the lock, 0 to wait indefinitely- Returns:
- True if the lock was acquired, false if waiting time elapsed before the lock was acquired
- Throws:
InterruptedException
- If the thread is interrupted while waiting to acquire the lock
-
release
Release the lock. No-op if the lock was never acquired. -
toString
-
getProc
-