Package org.glassfish.api.admin
Class AdminCommandLock
- java.lang.Object
-
- org.glassfish.api.admin.AdminCommandLock
-
@Service @Singleton public class AdminCommandLock extends Object
The implementation of the admin command lock.- Author:
- Bill Shannon, Chris Kasso
-
-
Constructor Summary
Constructors Constructor Description AdminCommandLock()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
getLockOwner()
Get the admin user id for the user who acquired the exclusive lock.Date
getLockTimeOfAcquisition()
Get the time the exclusive lock was acquired.
-
-
-
Method Detail
-
getLock
public Lock getLock(CommandLock.LockType type)
Return the appropriate Lock object for the specified LockType. The returned lock has not been locked. If the LockType is not SHARED or EXCLUSIVE null is returned.- Parameters:
type
- the LockType- Returns:
- the Lock object to use, or null
-
getLock
public Lock getLock(AdminCommand command)
Return the appropriate Lock object for the specified command. The returned lock has not been locked. If this command needs no lock, null is returned.- Parameters:
command
- the AdminCommand object- Returns:
- the Lock object to use, or null if no lock needed
-
getLock
public Lock getLock(AdminCommand command, String owner) throws AdminCommandLockTimeoutException, AdminCommandLockException
Return the appropriate Lock object for the specified command. The returned lock has been locked. If this command needs no lock, null is returned.- Parameters:
command
- the AdminCommand objectowner
- the authority who requested the lock- Returns:
- the Lock object to use, or null if no lock needed
- Throws:
AdminCommandLockTimeoutException
AdminCommandLockException
-
getLockOwner
public String getLockOwner()
Get the admin user id for the user who acquired the exclusive lock. This does not imply the lock is still held.- Returns:
- the admin user who acquired the lock
-
getLockTimeOfAcquisition
public Date getLockTimeOfAcquisition()
Get the time the exclusive lock was acquired. This does not imply the lock is still held.- Returns:
- the time the lock was acquired
-
-