com.cometway.ak
Class RunnableAgent

java.lang.Object
  extended by com.cometway.props.Props
      extended by com.cometway.ak.Agent
          extended by com.cometway.ak.RunnableAgent
All Implemented Interfaces:
AgentInterface, HasStateMachineModel, java.lang.Runnable

public class RunnableAgent
extends Agent
implements java.lang.Runnable

This agent calls its own run() method on its own Thread.


Field Summary
protected  java.lang.Thread agentThread
           
 
Fields inherited from class com.cometway.ak.Agent
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter
 
Constructor Summary
RunnableAgent()
           
 
Method Summary
 void initProps()
          Initializes default properties for this agent: agent_classname (default: none), java class name that the agent kernel will instantiate and start on a Thread provided by this agent.
 void run()
          This method is executed on a Thread when it is started.
 void start()
          Starts the Thread that will execute this agent's run() method.
protected  void startThread()
          Creates a Thread to execute this agent's run() method.
 
Methods inherited from class com.cometway.ak.Agent
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, stop, toString, unregister, unregisterService, warning, warning
 
Methods inherited from class com.cometway.props.Props
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

agentThread

protected java.lang.Thread agentThread
Constructor Detail

RunnableAgent

public RunnableAgent()
Method Detail

initProps

public void initProps()
Initializes default properties for this agent: agent_classname (default: none), java class name that the agent kernel will instantiate and start on a Thread provided by this agent.

Specified by:
initProps in interface AgentInterface
Overrides:
initProps in class Agent

start

public void start()
Starts the Thread that will execute this agent's run() method. Nothing will happen here if agent_classname is equals to "none".

Specified by:
start in interface AgentInterface
Overrides:
start in class Agent

startThread

protected void startThread()
Creates a Thread to execute this agent's run() method.


run

public void run()
This method is executed on a Thread when it is started. If agent_classname is provided, a new agent of the specified class is instantiated and started between Thread.sleep() cycles of the duration in milliseconds specified by thread_sleep_ms.

Specified by:
run in interface java.lang.Runnable