public class AgentLockService extends Object implements LockLevelService, ServiceLifecycle, AgentService
| Modifier and Type | Class and Description |
|---|---|
static interface |
AgentLockService.AgentLockUpdateListener
Interface for being notified of lock update events.
|
| Constructor and Description |
|---|
AgentLockService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener slul) |
void |
attachLock(String agentName)
Request for this agent to attach a lock on the given subsystem that is
already owned by the user.
|
void |
destroyLock(String agentName,
String userId)
destroys a lock.
|
void |
detachLock(String agentName)
Request for this agent to detach a lock on the given subsystem.
|
AgentLoginService |
getAgentLoginService() |
String |
getAgentServiceName()
Get the name of this service.
|
AgentStateService |
getAgentStateService() |
List<String> |
getAllWorkerAgents() |
List<String> |
getAttachableAgents() |
List<String> |
getDetachableAgents() |
AgentLock |
getExistingLockForAgent(String agentName)
Returns a lock held by any agent on the given
agentName, or null if
no agent holds a lock on the given agent |
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> |
getLocallyLockedAgents() |
List<String> |
getLockableAgents() |
List<String> |
getLockedAgents() |
AgentLock |
getLockForAgent(String agentName)
Returns a lock held by the associated agent and userid 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.
|
String |
getUserId() |
void |
lockAgent(String agentName)
Request for this agent to obtain a lock on the given subsystem.
|
void |
preInit() |
void |
preStart()
Called from the enclosing
Subsystem when
org.lsst.ccs.Subsystem#start() has been called. |
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, waitafterBuild, afterInit, afterStart, preBuild, preShutdownstartForAgentpublic AgentStateService getAgentStateService()
public AgentLoginService getAgentLoginService()
public String getAgentServiceName()
AgentServicegetAgentServiceName in interface AgentServicepublic void preInit()
preInit in interface ServiceLifecyclepublic void preStart()
ServiceLifecycleSubsystem when
org.lsst.ccs.Subsystem#start() has been called.
The preceding lifecycle step is HasLifecycle.postInit()
The following lifecycle step is HasLifecycle.start()
At the time it is called :
PhaseState is
INITIALIZING
connection with the messaging layer is effective, the enclosing
subsystem has started StatusHeartBeat
publication
preStart 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 AgentLock getExistingLockForAgent(String agentName)
agentName, or null if
no agent holds a lock on the given agentagentName - public void lockAgent(String agentName) throws UnauthorizedLockException, IOException
AgentLockUpdateListener will be notified. The list of owned valid
locks will be updated. This command will return only when the lock has been
acknowledged tbrough network exchanges.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 UnauthorizedLockException, IOException
AgentLockUpdateListener will be notified. The
list of owned valid locks will be updated. Non-blocking.agentName - UnauthorizedLockException - if the user did not have a lock on the
specified AgentIOException - if there was a communication problem on the
buses.public void attachLock(String agentName) throws UnauthorizedLockException, IOException
AgentLockUpdateListener will be notified. This command
will return only when the lock has been acknowledged tbrough network
exchanges.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 detachLock(String agentName) throws UnauthorizedLockException, IOException
AgentLockUpdateListener will be notified. The list of
owned valid locks will be updated. Non-blocking.agentName - UnauthorizedLockException - if the user did not have a lock on the
specified AgentIOException - 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 String getUserId()
public void addAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener slul)
slul - public void removeAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener l)
Copyright © 2022 LSST. All rights reserved.