| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The TaskManager class stores task objects with their associated conversation IDs for
an agent. The agent must add it's tasks during initialisation.
Each task can be used to handle the messages for a particular conversation that an
agent participates in. For example. if an agent registers with a DF on startup, one task
object can be used to handle this conversation without having to store any state for
other conversations - even if they have the same protocol.
Inner Class Summary | |
public static class | TaskManager.DefaultTaskManagerListener Default implementation of the TM Listener - just adds events back to TM in the order they arrive |
Field Summary | |
(package private) boolean | _shutdown Indicates if the TM has been shutdown |
Constructor Summary | |
TaskManager(FIPAOSAgent owner, MessageSender ms, Task top_level_parent, TaskManagerProfile tmp) Constructs an empty task manager. |
Method Summary | |
(package private) void | addEvent(Task task, TaskEvent event) Adds the given TaskEvent to the given Task, and informs the registered listener |
synchronized void | appendToExecutionOrder(Task t) Append a Task to the execution order (Tasks are executed in the order they are added to the execution order). |
(package private) void | forward(ACL acl, Task task) Sends an ACL message on behalf of the given Task. |
(package private) void | forward(Message msg, Task task) Sends a Message on behalf of the given Task. |
synchronized Set | getActiveTasks() List the active Tasks |
(package private) ACL | getNewConversation(String protocol) Sets up a new Conversation using the given protocol |
synchronized int | getPendingTaskEvents() Get info. |
synchronized int | getTaskCount() Get info. |
int | getTimeoutCount() Get info. |
static Set | getVMTaskManagers() Get set of all TM's in VM |
void | newTask(Task task) Initializes a new "top-level" task and adds it to the TaskManager. |
(package private) void | newTask(Task task, Task parent) Creates a new Task with the given parent |
(package private) void | newTask(String name, Task task, Task parent) Creates a new Task with the given parent and the given alternate Task name |
void | newTask(String name, Task task) Creates a new Task with the top level handler task as parent and the given alternate Task name |
void | newTask(Task t, String id) Initializes a new "top-level" task and adds it to the TaskManager. |
void | newTask(Task t, Conversation conv) Initializes a new "top-level" task and adds it to the TaskManager. |
void | newTask(Task task, Conversation conv, Task parent) Initializes a new child-task and adds it to the TaskManager. |
void | newTask(String name, Task task, Conversation conv) Initializes a new child-task and adds it to the TaskManager. |
void | newTask(String name, Task task, Conversation conv, Task parent) Initializes a new child-task and adds it to the TaskManager. |
void | newTask(Task task, long timeout) Initialises the given task, and invokes its start() method. |
(package private) void | newTask(Task task, long timeout, Task parent) Initialises the given task, and invokes its start() method. |
void | newTask(Task task, Conversation conv, long timeout) Initialises the given task, and invokes its start() method. |
void | newTask(Task task, Conversation conv, long timeout, Task parent) Initializes a new "top-level" task and adds it to the TaskManager. |
void | notify(Conversation conv) Conversation listener method to deal with conversations being sent by the planner scheduler. |
void | notify(Enumeration enum) Deals with multiple conversations at once - just calls notify( Conversation ) for each one. |
void | notifyMessageInEndedConversation(Message msg) Indicates that the given Message arrived for a completed Conversation - pass it to IDLE task |
void | notifyMessageUndeliverable(Message msg) Indicates that the given Message was not deliverable NOTE: This is a new feature which hasn't been fully tested |
boolean | removeTask(String key) Removes a task object associated with the specified conversation id from the manager. |
boolean | removeTask(Task task) Removes a task object from the manager. |
void | setMessageSender(MessageSender ms) Sets the MessageSender that this should use |
synchronized void | setTaskManagerListener(TaskManagerListener tml) Setup the TaskManageristener |
synchronized void | shutdown() Shuts-down this TaskManager - prevents any new Tasks from starting |
String | toString() Get the name of the owning Agent |
Field Detail |
boolean _shutdown
Constructor Detail |
public TaskManager(FIPAOSAgent owner, MessageSender ms, Task top_level_parent, TaskManagerProfile tmp)
Method Detail |
void addEvent(Task task, TaskEvent event)
public synchronized void appendToExecutionOrder(Task t)
void forward(ACL acl, Task task)
Sends an ACL message on behalf of the given Task.
If the message is part of a new conversation, a Conversation object will
be created within the ConversationManager and the Task will be bound to that
Conversation's ID - hence the task will subsequently receive any messages in response
automatically.
Note: a call to this method will update the table of all conversation ids and related tasks so
that the conversation id is always associated with the last task that calls this method.
void forward(Message msg, Task task)
Sends a Message on behalf of the given Task.
If the message is part of a new conversation, a Conversation object will
be created within the ConversationManager and the Task will be bound to that
Conversation's ID - hence the task will subsequently receive any messages in response
automatically.
Note: a call to this method will update the table of all conversation ids and related tasks so
that the conversation id is always associated with the last task that calls this method.
public synchronized Set getActiveTasks()
ACL getNewConversation(String protocol)
public synchronized int getPendingTaskEvents()
public synchronized int getTaskCount()
public int getTimeoutCount()
public static Set getVMTaskManagers()
public void newTask(Task task)
void newTask(Task task, Task parent)
void newTask(String name, Task task, Task parent)
public void newTask(String name, Task task)
public void newTask(Task t, String id)
public void newTask(Task t, Conversation conv)
public void newTask(Task task, Conversation conv, Task parent)
public void newTask(String name, Task task, Conversation conv)
public void newTask(String name, Task task, Conversation conv, Task parent)
public void newTask(Task task, long timeout)
void newTask(Task task, long timeout, Task parent)
public void newTask(Task task, Conversation conv, long timeout)
public void newTask(Task task, Conversation conv, long timeout, Task parent)
public void notify(Conversation conv)
public void notify(Enumeration enum)
public void notifyMessageInEndedConversation(Message msg)
public void notifyMessageUndeliverable(Message msg)
NOTE: This is a new feature which hasn't been fully tested
public boolean removeTask(String key)
public boolean removeTask(Task task)
public void setMessageSender(MessageSender ms)
public synchronized void setTaskManagerListener(TaskManagerListener tml)
public synchronized void shutdown()
public String toString()
Association Links |
to Class java.lang.String
to Class java.util.Set
to Class java.util.Map
to Class java.util.Set
to Class java.util.Set
to Class java.util.Set
to Class fipaos.agent.FIPAOSAgent
to Class fipaos.mts.MessageSender
to Class fipaos.util.Queue
to Class fipaos.agent.task.TaskManagerListener
to Class fipaos.agent.task.Task
to Class fipaos.util.ThreadPool
to Class fipaos.util.ThreadPool
to Class fipaos.agent.profile.TaskManagerProfile
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |