| |||||||||
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. |
Object | getContext() Gets a context object for this Task - allows a parent-Task to associate some arbritary "context" with a child-Task which it can pickup when the child completes/fails |
TaskState | getState() Returns the TaskState associated with this Task |
void | handleAcceptProposal(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleAgree(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleCfp(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleConfirm(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleDisconfirm(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleFailure(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleInform(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleInformIf(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleInformRef(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleLateMessage(Message msg) Please override implementation - by default sends a not-understood |
void | handleNotUnderstood(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handlePropagate(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handlePropose(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleProxy(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleQueryIf(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleQueryRef(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleRefuse(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleRejectProposal(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleRequest(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleRequestWhen(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleRequestWhenever(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleSubscribe(Conversation c) Dummy method - please override implementation and DO NOT invoke |
void | handleUndeliverableMessage(Message msg) Please override implementation to deal with undeliverable messages NOTE: Not yet implemented |
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 |
void | notifyMessageFailure(Message msg) Dispatches incoming messages that have bounced for some reason. |
void | notifyMessageForEndedConversation(Message msg) Dispatches incoming message for ended conversation to the correct method. |
(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 |
void | setContext(Object o) Sets a context object for this Task - allows a parent-Task to associate some arbritary "context" with a child-Task which it can pickup when the child completes/fails |
(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. |
(package private) void | timeoutReached() Invoked when the timeout for this Task has been reached |
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 Object getContext()
public TaskState getState()
public void handleAcceptProposal(Conversation c)
public void handleAgree(Conversation c)
public void handleCfp(Conversation c)
public void handleConfirm(Conversation c)
public void handleDisconfirm(Conversation c)
public void handleFailure(Conversation c)
public void handleInform(Conversation c)
public void handleInformIf(Conversation c)
public void handleInformRef(Conversation c)
public void handleLateMessage(Message msg)
public void handleNotUnderstood(Conversation c)
public void handlePropagate(Conversation c)
public void handlePropose(Conversation c)
public void handleProxy(Conversation c)
public void handleQueryIf(Conversation c)
public void handleQueryRef(Conversation c)
public void handleRefuse(Conversation c)
public void handleRejectProposal(Conversation c)
public void handleRequest(Conversation c)
public void handleRequestWhen(Conversation c)
public void handleRequestWhenever(Conversation c)
public void handleSubscribe(Conversation c)
public void handleUndeliverableMessage(Message msg)
NOTE: Not yet implemented
public void notify(Conversation conv)
void notifyDone(Task child)
void notifyDone(Task child, Object result)
void notifyError(Task child, Throwable error)
public void notifyMessageFailure(Message msg)
public void notifyMessageForEndedConversation(Message msg)
void notifyStart()
void notifyTimeout(Task child)
void removeReferences()
public void setContext(Object o)
boolean thisThreadFirstToIndicateDone()
public void timeoutDFSearchTask(Task t)
void timeoutReached()
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
to Class java.lang.Object
to Class java.lang.Object
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |