public class AgentMBeanAdapter<T extends IAgent> extends Object implements IAgentMBeanAdapter
| Modifier and Type | Field and Description |
|---|---|
static String |
AGENT_NAME_FLAG_NAME |
static String |
AGENT_STATE_FLAG_NAME |
| Constructor and Description |
|---|
AgentMBeanAdapter(T agent,
ObjectName objectName,
MBeanServer mbs) |
| Modifier and Type | Method and Description |
|---|---|
protected T |
getAgent() |
String |
getComponentId()
Returns id of the agent - unique across the JVMs.
|
String |
getName()
Returns human readable name.
|
ObjectName |
getObjectName(String domain)
Returns JMX object name of the MBean.
|
IAgentState |
getState()
Returns the state of the agent (whether it's running / dead / etc.).
|
void |
kill()
Stops the agent (unconditionally), closing whatever connection it may have, this
method must be non-blocking + interrupting all the communication, logic or whatever
threads the agent may have.
|
void |
pause()
This should pause the the agent.
|
void |
resume()
This should resume the logic of the agent.
|
void |
start()
Attempt to launch the agent.
|
void |
stop()
Attempt to stop the agent, usually meaning dropping all running flags and see whether
it will stop automatically.
|
public static final String AGENT_STATE_FLAG_NAME
public static final String AGENT_NAME_FLAG_NAME
public AgentMBeanAdapter(T agent, ObjectName objectName, MBeanServer mbs) throws MalformedObjectNameException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException
protected T getAgent()
public ObjectName getObjectName(String domain) throws MalformedObjectNameException
IAgentMBeanAdaptergetObjectName in interface IAgentMBeanAdapterdomain - jmx domainMalformedObjectNameExceptionpublic String getComponentId()
IAgentMBeanAdaptergetComponentId in interface IAgentMBeanAdapterpublic IAgentState getState()
IAgentMBeanAdapterNote that the type AgentState wraps two things:
getState in interface IAgentMBeanAdapterpublic void start()
throws AgentException
IAgentMBeanAdapterstart in interface IAgentMBeanAdapterAgentExceptionpublic void pause()
throws AgentException
IAgentMBeanAdapterpause in interface IAgentMBeanAdapterAgentExceptionpublic void resume()
throws AgentException
IAgentMBeanAdapterresume in interface IAgentMBeanAdapterAgentExceptionpublic void stop()
throws AgentException
IAgentMBeanAdapterIf the stop can not complete - it must automatically call kill() method.
stop in interface IAgentMBeanAdapterAgentExceptionpublic void kill()
IAgentMBeanAdapterAfter calling kill() method, the only method that may be called is getState() to examine state of the agent.
This also equals to "exception happened outside the agent" and "IFatalErrorEvent should be propagated inside
the agent"
kill in interface IAgentMBeanAdapterpublic String getName()
IAgentMBeanAdaptergetName in interface IAgentMBeanAdapterCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.