@InterfaceAudience.Private private static class TableLockManager.ZKTableLockManager extends TableLockManager
Modifier and Type | Class and Description |
---|---|
private static class |
TableLockManager.ZKTableLockManager.TableLockImpl |
TableLockManager.NullTableLockManager, TableLockManager.TableLock
Modifier and Type | Field and Description |
---|---|
private long |
lockExpireTimeoutMs |
private static InterProcessLock.MetadataHandler |
METADATA_HANDLER |
private long |
readLockTimeoutMs |
private ServerName |
serverName |
private long |
writeLockTimeoutMs |
private ZooKeeperWatcher |
zkWatcher |
DEFAULT_TABLE_LOCK_EXPIRE_TIMEOUT_MS, DEFAULT_TABLE_READ_LOCK_TIMEOUT_MS, DEFAULT_TABLE_WRITE_LOCK_TIMEOUT_MS, TABLE_LOCK_ENABLE, TABLE_LOCK_EXPIRE_TIMEOUT, TABLE_READ_LOCK_TIMEOUT_MS, TABLE_WRITE_LOCK_TIMEOUT_MS
Constructor and Description |
---|
TableLockManager.ZKTableLockManager(ZooKeeperWatcher zkWatcher,
ServerName serverName,
long writeLockTimeoutMs,
long readLockTimeoutMs,
long lockExpireTimeoutMs)
Initialize a new manager for table-level locks.
|
Modifier and Type | Method and Description |
---|---|
private List<String> |
getTableNames() |
TableLockManager.TableLock |
readLock(TableName tableName,
String purpose)
Returns a TableLock for locking the table for shared access among read-lock holders
|
void |
reapAllExpiredLocks()
Force releases all table locks(read and write) that have been held longer than
"hbase.table.lock.expire.ms".
|
void |
reapWriteLocks()
Force releases table write locks and lock attempts even if this thread does
not own the lock.
|
void |
tableDeleted(TableName tableName)
Called after a table has been deleted, and after the table lock is released.
|
private static byte[] |
toBytes(org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock data) |
void |
visitAllLocks(InterProcessLock.MetadataHandler handler)
Visits all table locks(read and write), and lock attempts with the given callback
MetadataHandler.
|
TableLockManager.TableLock |
writeLock(TableName tableName,
String purpose)
Returns a TableLock for locking the table for exclusive access
|
createTableLockManager, fromBytes
private static final InterProcessLock.MetadataHandler METADATA_HANDLER
private final ServerName serverName
private final ZooKeeperWatcher zkWatcher
private final long writeLockTimeoutMs
private final long readLockTimeoutMs
private final long lockExpireTimeoutMs
public TableLockManager.ZKTableLockManager(ZooKeeperWatcher zkWatcher, ServerName serverName, long writeLockTimeoutMs, long readLockTimeoutMs, long lockExpireTimeoutMs)
zkWatcher
- serverName
- Address of the server responsible for acquiring and
releasing the table-level lockswriteLockTimeoutMs
- Timeout (in milliseconds) for acquiring a write lock for a
given table, or -1 for no timeoutreadLockTimeoutMs
- Timeout (in milliseconds) for acquiring a read lock for a
given table, or -1 for no timeoutprivate static byte[] toBytes(org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.TableLock data)
public TableLockManager.TableLock writeLock(TableName tableName, String purpose)
TableLockManager
writeLock
in class TableLockManager
tableName
- Table to lockpurpose
- Human readable reason for locking the tablepublic TableLockManager.TableLock readLock(TableName tableName, String purpose)
TableLockManager
readLock
in class TableLockManager
tableName
- Table to lockpurpose
- Human readable reason for locking the tablepublic void visitAllLocks(InterProcessLock.MetadataHandler handler) throws IOException
TableLockManager
visitAllLocks
in class TableLockManager
handler
- the metadata handler to callIOException
- If there is an unrecoverable errorprivate List<String> getTableNames() throws IOException
IOException
public void reapWriteLocks() throws IOException
TableLockManager
reapWriteLocks
in class TableLockManager
IOException
- If there is an unrecoverable errorpublic void reapAllExpiredLocks() throws IOException
TableLockManager
reapAllExpiredLocks
in class TableLockManager
IOException
- If there is an unrecoverable errorpublic void tableDeleted(TableName tableName) throws IOException
TableLockManager
tableDeleted
in class TableLockManager
tableName
- name of the tableIOException
- If there is an unrecoverable error releasing the lockCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.