public class StateLockManager extends Object
lockShared()
will be used by user RPCs and may throw InterruptedException
based on options passed to lockExclusive(StateLockOptions)
.
lockExclusive(StateLockOptions)
will be used by metadata backups in order to
guarantee paused state during critical tasks.Constructor and Description |
---|
StateLockManager()
Creates a new state-lock manager.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getSharedWaitersAndHolders() |
boolean |
interruptCycleTicking() |
LockResource |
lockExclusive(StateLockOptions lockOptions)
Locks the state exclusively.
|
LockResource |
lockExclusive(StateLockOptions lockOptions,
RetryUtils.RunnableThrowsIOException beforeAttempt)
Locks the state exclusively.
|
LockResource |
lockShared()
Locks the state shared.
|
void |
mastersStartedCallback()
This is called by owning process in order to signal that
the state is read completely and masters are started.
|
public void mastersStartedCallback()
public LockResource lockShared() throws InterruptedException
InterruptedException
public LockResource lockExclusive(StateLockOptions lockOptions) throws TimeoutException, InterruptedException, IOException
lockOptions
- exclusive lock optionsTimeoutException
- if locking times outInterruptedException
- if interrupting during lockingIOException
public LockResource lockExclusive(StateLockOptions lockOptions, RetryUtils.RunnableThrowsIOException beforeAttempt) throws TimeoutException, InterruptedException, IOException
lockOptions
- exclusive lock optionsbeforeAttempt
- a function which runs before each lock attempt and returns whether the
lock should continueTimeoutException
- if locking times outInterruptedException
- if interrupting during lockingIOException
- if the beforeAttempt functions failspublic List<String> getSharedWaitersAndHolders()
public boolean interruptCycleTicking()
true
if the interrupt-cycle has been ticked and tickingCopyright © 2023. All Rights Reserved.