@Service @Singleton public class AdminCommandLock extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AdminCommandLock.SuspendStatus
The status of a suspend command attempt.
|
| Constructor and Description |
|---|
AdminCommandLock() |
| Modifier and Type | Method and Description |
|---|---|
void |
dumpState(Logger logger,
Level level) |
Lock |
getLock(AdminCommand command)
Return the appropriate Lock object for the specified command.
|
Lock |
getLock(AdminCommand command,
String owner)
Return the appropriate Lock object for the specified command.
|
Lock |
getLock(CommandLock.LockType type)
Return the appropriate Lock object for the specified LockType.
|
String |
getLockMessage()
Get the message to be returned if the lock could not be acquired.
|
String |
getLockOwner()
Get the admin user id for the user who acquired the exclusive lock.
|
Date |
getLockTimeOfAcquisition()
Get the time the exclusive lock was acquired.
|
boolean |
isSuspended()
Indicates if commands are currently suspended.
|
Thread |
resumeCommands()
Release the lock allowing the DAS to accept commands.
|
static void |
runWithSuspendedLock(Runnable r)
Use this method to temporarily suspend the command lock during
which other operations may be performed.
|
AdminCommandLock.SuspendStatus |
suspendCommands(long timeout,
String lockOwner)
Lock the DAS from accepting any commands annotated with a SHARED
or EXCLUSIVE CommandLock.
|
AdminCommandLock.SuspendStatus |
suspendCommands(long timeout,
String lockOwner,
String message)
Lock the DAS from accepting any commands annotated with a SHARED
or EXCLUSIVE CommandLock.
|
public Lock getLock(CommandLock.LockType type)
type - the LockTypepublic Lock getLock(AdminCommand command)
command - the AdminCommand objectpublic Lock getLock(AdminCommand command, String owner) throws AdminCommandLockTimeoutException, AdminCommandLockException
command - the AdminCommand objectowner - the authority who requested the lockAdminCommandLockTimeoutExceptionAdminCommandLockExceptionpublic String getLockOwner()
public String getLockMessage()
public Date getLockTimeOfAcquisition()
public boolean isSuspended()
public AdminCommandLock.SuspendStatus suspendCommands(long timeout, String lockOwner)
timeout - lock timeout in secondslockOwner - the user who acquired the lockpublic AdminCommandLock.SuspendStatus suspendCommands(long timeout, String lockOwner, String message)
timeout - lock timeout in secondslockOwner - the user who acquired the lockmessage - message to return when a command is blockedpublic Thread resumeCommands()
public static void runWithSuspendedLock(Runnable r)
r - A Runnable which will be invoked by the method after the lock is suspendedCopyright © 2017–2020 Eclipse Foundation. All rights reserved.