
public class AgentLockService extends Object implements LockLevelService, AgentPresenceListener, ServiceLifecycle, AgentService
| Modifier and Type | Class and Description |
|---|---|
static interface |
AgentLockService.AgentLevelListener
Interface for being notified of subsystem level change events.
|
static interface |
AgentLockService.AgentLockUpdateListener
Interface for being notified of lock update events.
|
| Constructor and Description |
|---|
AgentLockService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAgentLevelListener(AgentLockService.AgentLevelListener l) |
void |
addAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener slul) |
void |
connecting(AgentInfo ai)
Indicates that the agent represented by
agent is present on the
buses. |
String |
getAgentServiceName()
Get the name of this service.
|
List<String> |
getAllWorkerAgents() |
Map<String,AgentLock> |
getHeldLocks()
Get information of the locks currently held by this agent.
|
int |
getLevelForAgent(String agentName)
Get this agent's authorized level at which it can operate the given
agentName. |
List<String> |
getLockableAgents() |
List<String> |
getLockedAgents() |
AgentLock |
getLockForAgent(String agentName)
Returns a lock held by the associated agent on the given
agentName, or null if the associated agent does not hold a lock
on the given agent |
Map<String,AgentLock> |
getLocks()
Get information on all the current existing locks in a cluster of subsystems.
|
void |
lockAgent(String agentName)
Request for this agent to obtain a lock on the given subsystem.
|
void |
preInit() |
void |
removeAgentLevelListener(AgentLockService.AgentLevelListener l) |
void |
removeAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener l) |
void |
setLevelForAgent(String agentName,
int level)
Set this agent's operational level for the given subsystem.
|
void |
unlockAgent(String agentName)
Request for this agent to release a lock on the given subsystem.
|
boolean |
validateLock(AgentLock lock)
Validate a lock object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnecting, disconnectingpreBuild, preShutdown, preStartstartForAgentpublic String getAgentServiceName()
AgentServicegetAgentServiceName in interface AgentServicepublic void preInit()
preInit in interface ServiceLifecyclepublic void setLevelForAgent(String agentName, int level) throws UnauthorizedLevelException, UnauthorizedLockException, IOException
AgentLevelListener will be notified with the new level valueagentName - the subsystem for which to change the levellevel - the level to setUnauthorizedLevelException - if the requested level cannot be set. This
happens if this agent owns a lock on the given subsystem and that lock
defines a maximum level that is lower than the requested level, or if
this agent does not hold a lock on the given subsystem and this agent's
default subsystem level is lower than the requested level.UnauthorizedLockException - if the user is not allowed to acquire a
lock on the specified AgentIOException - if there was a communication problem on the buses.public int getLevelForAgent(String agentName)
agentName. It returns 0 if this agent does not hold a lock on
agentName.getLevelForAgent in interface LockLevelServiceagentName - the agent to get the level for.public AgentLock getLockForAgent(String agentName)
agentName, or null if the associated agent does not hold a lock
on the given agentgetLockForAgent in interface LockLevelServiceagentName - public void lockAgent(String agentName) throws UnauthorizedLockException, IOException
AgentLockUpdateListener will be notified.
The list of owned valid locks will be updated.agentName - UnauthorizedLockException - if the user is not allowed to acquire a
lock on the specified AgentIOException - if there was a communication problem on the buses.public void unlockAgent(String agentName) throws IOException
AgentLockUpdateListener and AgentLevelListener will be notified.
The list of owned valid locks will be updated.agentName - IOException - if there was a communication problem on the buses.public Map<String,AgentLock> getLocks()
public Map<String,AgentLock> getHeldLocks()
public boolean validateLock(AgentLock lock)
lock - the lock object to validatepublic void addAgentLevelListener(AgentLockService.AgentLevelListener l)
l - public void removeAgentLevelListener(AgentLockService.AgentLevelListener l)
public void addAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener slul)
slul - public void removeAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener l)
public void connecting(AgentInfo ai)
AgentPresenceListeneragent is present on the
buses.
The implementation should return immediately : any blocking operations
should be scheduled on a separate thread.connecting in interface AgentPresenceListenerCopyright © 2018 LSST. All rights reserved.