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
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Stringprivate LockProcedureprivate final RegionInfo[]private final TableNameprivate final LockType -
Constructor Summary
ConstructorsConstructorDescriptionMasterLock(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) LockProceduregetProc()voidrelease()Release the lock.toString()booleantryAcquire(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
-