|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cz.cuni.amis.pogamut.base.agent.jmx.proxy.AgentJMXProxy
public class AgentJMXProxy
Makes it possible to control agent running in remote JVM through JMX protocol.
Constructor Summary | |
---|---|
AgentJMXProxy(java.lang.String agentJmxAddress)
|
Method Summary | |
---|---|
protected java.lang.Object |
call(java.lang.String actionName)
|
protected java.lang.Object |
callNoException(java.lang.String actionName)
All exceptions are wrapped in RuntimeException. |
protected java.lang.Object |
callNoException(java.lang.String actionName,
java.lang.Object[] params,
java.lang.String[] sig)
All exceptions are wrapped in RuntimeException. |
protected java.lang.Object |
getAttributeNoException(java.lang.String atr)
|
IAgentId |
getComponentId()
Returns agent id - contains also a human-readable name that can be changed |
IComponentBus |
getEventBus()
IComponentBus that the instance is working with. |
Folder |
getIntrospection()
Returns folder with introspection information. |
java.util.logging.Logger |
getLog()
|
IAgentLogger |
getLogger()
Returns AgentLogger for the instance allowing creating new log categories or adding new handlers to them. |
protected javax.management.MBeanServerConnection |
getMBeanServerConnection()
|
java.lang.String |
getName()
Returns human-readable agent's name. |
javax.management.ObjectName |
getObjectName()
|
ImmutableFlag<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 |
startPaused()
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AgentJMXProxy(java.lang.String agentJmxAddress)
Method Detail |
---|
protected javax.management.MBeanServerConnection getMBeanServerConnection()
public javax.management.ObjectName getObjectName()
public IAgentLogger getLogger()
IAgent
getLogger
in interface IAgent
public java.util.logging.Logger getLog()
public ImmutableFlag<IAgentState> getState()
IAgent
Note that the type AgentState wraps two things:
getState
in interface IAgent
protected java.lang.Object callNoException(java.lang.String actionName)
actionName
-
protected java.lang.Object callNoException(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] sig)
actionName
-
protected java.lang.Object call(java.lang.String actionName) throws AgentException
AgentException
protected java.lang.Object getAttributeNoException(java.lang.String atr)
public void start() throws AgentException
IAgent
This method is not suitable for simultaneous start of multiple agents that should start working together in the environment.
(I.e., during tournaments of agents when you need to synchronize their start in the environment.) In such cases
use IAgent.startPaused()
and then multiple threads+barrier to execute IAgent.resume()
of all agents at once.
start
in interface IAgent
start
in interface IControllable
AgentException
public void startPaused() throws ComponentCantStartException
IAgent
In contrast with IAgent.start()
this method will initialize the agent inside the environment but pauses
it after the start (i.e., its reasoning should not run, the action should not do any decisions).
To fully start the agent, you need to IAgent.resume()
it.
It is designed to provide safe synchronization of multiple agent simulations when you need to start the reasoning of agents synchronously.
startPaused
in interface IAgent
ComponentCantStartException
public void pause() throws AgentException
IAgent
pause
in interface IAgent
AgentException
public void resume() throws AgentException
IAgent
resume
in interface IAgent
AgentException
public void stop()
IAgent
If the stop can not complete - it must automatically call kill() method.
stop
in interface IAgent
stop
in interface IControllable
public void kill()
IAgent
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"
kill
in interface IAgent
kill
in interface IControllable
public IAgentId getComponentId()
IAgent
getComponentId
in interface IAgent
getComponentId
in interface IComponent
public java.lang.String getName()
IAgent
Do not use as unique id of the agent:
1) the name might change during the life of agent
2) we do not ensure it's unique
Use getComponentId().getToken() instead!
Use getComponentId().getName().setFlag() to change the name of the agent.
getName
in interface IAgent
public Folder getIntrospection()
IAgent
getIntrospection
in interface IAgent
public IComponentBus getEventBus()
IComponentAware
IComponentBus
that the instance is working with.
Note that by design-choice - the IComponentBus
is a singleton inside AgentScoped
,
therefore you don't have to necessarily obtain the instance through the component, it suffice
to obtain it using injection into your object.
getEventBus
in interface IComponentAware
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |