cz.cuni.amis.pogamut.base.agent.jmx.adapter
Interface IAgentMBeanAdapter

All Known Subinterfaces:
Agent3DMBeanAdapterMBean, BotJMXMBeanAdapterMBean
All Known Implementing Classes:
Agent3DMBeanAdapter, AgentMBeanAdapter, BotJMXMBeanAdapter

@MXBean
public interface IAgentMBeanAdapter

Interface for the adapter of the Agent MBean.


Method Summary
 java.lang.String getComponentId()
          Returns id of the agent - unique across the JVMs.
 java.lang.String getName()
          Returns human readable name.
 javax.management.ObjectName getObjectName(java.lang.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.
 

Method Detail

getObjectName

javax.management.ObjectName getObjectName(java.lang.String domain)
                                          throws javax.management.MalformedObjectNameException
Returns JMX object name of the MBean.

Parameters:
domain - jmx domain
Returns:
name under which the MBean should be exported
Throws:
javax.management.MalformedObjectNameException

getComponentId

java.lang.String getComponentId()
Returns id of the agent - unique across the JVMs.

Returns:

getName

java.lang.String getName()
Returns human readable name. getDisplayName is set by agent and doesn't have to be unique, while getName is machine assigned and is unique.


getState

IAgentState getState()
Returns the state of the agent (whether it's running / dead / etc.).

Note that the type AgentState wraps two things:

Returns:

start

void start()
           throws AgentException
Attempt to launch the agent. If it does not throw an exception, agent has been successfully started, also the state of the agent state is changed into Running state.

Throws:
AgentException

pause

void pause()
           throws AgentException
This should pause the the agent. If it does not throw an exception, agent has been successfully started, also the state of the agent state is changed into Paused state.

If your agent can't be paused, throw OperationNotSupportedException.

Throws:
AgentException

resume

void resume()
            throws AgentException
This should resume the logic of the agent. If it does not throw an exception, agent has been successfully resumed, also the state of the agent state is changed into Running state.

If your agent can't be paused therefore can't be resumed, throw OperationNotSupportedException.

Throws:
AgentException

stop

void stop()
          throws AgentException
Attempt to stop the agent, usually meaning dropping all running flags and see whether it will stop automatically. This method may be blocking. If it does not throw the exception, the agent has been successfully stopped, also the state of the agent is changed into End state.

If the stop can not complete - it must automatically call kill() method.

Throws:
AgentException

kill

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.

After 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"