| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class is an abstract representation of an agent task. It contains message dispatchers and dummy handling methods. To implement tasks in your agent, subclass this class and override the methods for the message types that you need to handle. For example, if your agent handles two conversations - one of type request and the other of contract net, then you would create two task classes that subclass this class. One that handles fipa-request protocol messages only, and on the handles fipa-contract-net messages only.
The Task-lifecycle is as follows:
Field Summary | |
(package private) boolean | _done Indicates if this task is done, or has timedout |
(package private) String | _id ID of this task (?) |
(package private) Task | _parent Reference to the "parent" Task of this. |
(package private) TaskState | _state State of this Task |
(package private) long | _timeout Timeout value for this task |
(package private) Set | _tm_ids TaskManager ID's that this is associated with |
Constructor Summary | |
Task() Constructs a Task object - to fully initialise a Task object, use the Task or TaskManager newTask() method |
Method Summary | |
void | doneDFSearchTask(Object result) Callback method to indicate that a DFSearchTask has completed. |
void | errorDFSearchTask(Task t, Throwable exception) Callback method to indicate that a DFSearchTask has failed. |
TaskState | getState() Returns the TaskState associated with this Task |
void | handleFailure(Conversation c) Dummy method - please override implementation |
void | handleInform(Conversation c) Dummy method - please override implementation |
void | handleRequest(Conversation c) Dummy method - please override implementation |
void | notify(Conversation conv) Dispatches incoming messages to the correct message handling method. |
(package private) void | notifyDone(Task child) Invokes the appropriate doneX() method on this, given the child task |
(package private) void | notifyDone(Task child, Object result) Invokes the appropriate doneX(Object) method on this, given the child task |
(package private) void | notifyError(Task child, Throwable error) Invoked by child-tasks to indicate that it has had an error |
(package private) void | notifyStart() Starts the given Task executing |
(package private) void | notifyTimeout(Task child) Invokes the appropriate timeoutX() method on this, given the child task |
(package private) void | removeReferences() Cleans up the reference that this task has to enable quicker garbage collection |
(package private) boolean | thisThreadFirstToIndicateDone() Ensure that we indicate that the Task is completed, without requiring a lock on the TM first (can lead to dealock since we need to check that _done is false BEFORE sync'ing on _tm - if _done is true it is possible that _tm is null, therefore we cannot safely sync. |
void | timeoutDFSearchTask(Task t) Callback method to indicate that a DFSearchTask has failed. |
Field Detail |
boolean _done
String _id
Task _parent
TaskState _state
long _timeout
Set _tm_ids
Constructor Detail |
public Task()
Method Detail |
public void doneDFSearchTask(Object result)
public void errorDFSearchTask(Task t, Throwable exception)
public TaskState getState()
public void handleFailure(Conversation c)
public void handleInform(Conversation c)
public void handleRequest(Conversation c)
public void notify(Conversation conv)
void notifyDone(Task child)
void notifyDone(Task child, Object result)
void notifyError(Task child, Throwable error)
void notifyStart()
void notifyTimeout(Task child)
void removeReferences()
boolean thisThreadFirstToIndicateDone()
public void timeoutDFSearchTask(Task t)
Association Links |
to Class java.lang.String
to Class java.lang.String
to Class java.lang.String
to Class fipaos.agent.FIPAOSAgent
to Class fipaos.agent.task.TaskManager
to Class fipaos.agent.task.TaskState
to Class java.lang.String
to Class java.util.Set
to Class fipaos.agent.task.Task
to Class java.util.Set
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |