
public class AgentPresenceManager extends Object implements StatusMessageListener, ClusterDisconnectionsListener
| Modifier and Type | Class and Description |
|---|---|
static class |
AgentPresenceManager.AgentPresenceState |
| Constructor and Description |
|---|
AgentPresenceManager(AgentInfo agentInfo) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAgentPresenceListener(AgentPresenceListener l) |
boolean |
agentExists(String agentName)
This method returns true as soon as the AgentPresenceManager is aware
of the existence of the given agent by name.
|
boolean |
isAgentConnected(AgentPropertyPredicate agentPredicate)
This method returns true when the given agent is fully connected, OPERATIONAL
and ready to receive commands.
|
boolean |
isAgentConnected(String agentName)
This method returns true when the given agent is fully connected, OPERATIONAL
and ready to receive commands.
|
List<AgentInfo> |
listConnectedAgents() |
void |
membersLeft(List<String> left) |
void |
onStatusMessage(StatusMessage s)
Called when a status message is received.
|
void |
removeAgentPresenceListener(AgentPresenceListener l) |
boolean |
waitForAgent(AgentPropertyPredicate predicate,
long timeout,
TimeUnit unit) |
boolean |
waitForAgent(String name,
long timeout,
TimeUnit unit)
Wait for an Agent to be fully connected: all the listeners have been
notified on the connected method.
|
boolean |
waitForAgentDisconnection(String name,
long timeout,
TimeUnit unit)
Wait for an Agent to be fully disconnected: all the listeners have been
notified on the disconnected method.
|
public AgentPresenceManager(AgentInfo agentInfo)
public void onStatusMessage(StatusMessage s)
StatusMessageListeneronStatusMessage in interface StatusMessageListeners - Status bus message to be processed.public List<AgentInfo> listConnectedAgents()
public void membersLeft(List<String> left)
membersLeft in interface ClusterDisconnectionsListenerpublic void addAgentPresenceListener(AgentPresenceListener l)
public void removeAgentPresenceListener(AgentPresenceListener l)
public boolean agentExists(String agentName)
#isAgentConnected(String) instead.agentName - The name of the agentpublic boolean isAgentConnected(String agentName)
agentName - The name of the Agent.public boolean isAgentConnected(AgentPropertyPredicate agentPredicate)
agentPredicate - The predicate to select the Agent.public final boolean waitForAgent(String name, long timeout, TimeUnit unit) throws InterruptedException
name - The name of the Agenttimeout - The time to wait for the agent to become available.unit - The TimeUnit for the timeout.InterruptedExceptionpublic final boolean waitForAgent(AgentPropertyPredicate predicate, long timeout, TimeUnit unit) throws InterruptedException
InterruptedExceptionpublic final boolean waitForAgentDisconnection(String name, long timeout, TimeUnit unit) throws InterruptedException
name - The name of the Agenttimeout - The time to wait for the agent to become available.unit - The TimeUnit for the timeout.InterruptedExceptionCopyright © 2021 LSST. All rights reserved.