fipaos.agent.task
Class SynchronousTask

fipaos.agent.task.Task
  |
  +--fipaos.agent.task.SynchronousTask

public class SynchronousTask
extends Task

This task enables a Task to be started and its result to be captured by
making a single method invocation


Inner Class Summary
 public static classSynchronousTask.ErrorResult
          Indicates that an exception occured within the Task
 public static classSynchronousTask.NoResult
          Indicates that the Task didn't return a result
 public static classSynchronousTask.TimeoutResult
          Indicates that the Task timed-out
 public static classSynchronousTask.UnusualResult
          A sub-class is returned by executeTask() when something out of the ordinary happens

Fields inherited from class fipaos.agent.task.Task
_done, _id, _parent, _state, _timeout, _tm_ids

Method Summary
 static ObjectexecuteTask(TaskManager tm, Task t)
          Executes the given Task, and returns the result - in the event that something
unexpected happens, an object of type UnusualResult is returned

The Task must not have been initialised

WARNING: This method shouldn't be invoked from within the code for a Task!
 static ObjectexecuteTask(TaskManager tm, Task t, long timeout)
          Executes the given Task, and returns the result - in the event that something
unexpected happens, an object of type UnusualResult is returned

The Task must not have been initialised

WARNING: This method shouldn't be invoked from within the code for a Task!
 (package private) voidnotifyDone(Task child)
          Invokes the appropriate doneX() method on this, given the child task
 (package private) voidnotifyDone(Task child, Object result)
          Invokes the appropriate doneX(Object) method on this, given the child task
 (package private) voidnotifyError(Task child, Throwable error)
          Invoked by child-tasks to indicate that it has had an error
 (package private) voidnotifyTimeout(Task child)
          Invokes the appropriate timeoutX() method on this, given the child task
 voidstartTask()
          Invoked when the task starts

Methods inherited from class fipaos.agent.task.Task
doneDFSearchTask, endTask, errorDFSearchTask, getContext, getState, handleAcceptProposal, handleAgree, handleCfp, handleConfirm, handleDisconfirm, handleFailure, handleInform, handleInformIf, handleInformRef, handleLateMessage, handleNotUnderstood, handlePropagate, handlePropose, handleProxy, handleQueryIf, handleQueryRef, handleRefuse, handleRejectProposal, handleRequest, handleRequestWhen, handleRequestWhenever, handleSubscribe, handleUndeliverableMessage, notify, notifyMessageFailure, notifyMessageForEndedConversation, notifyStart, removeReferences, setContext, thisThreadFirstToIndicateDone, timeoutDFSearchTask, timeoutReached

Method Detail

executeTask

public static Object executeTask(TaskManager tm, Task t)
Executes the given Task, and returns the result - in the event that something
unexpected happens, an object of type UnusualResult is returned

The Task must not have been initialised

WARNING: This method shouldn't be invoked from within the code for a Task!


executeTask

public static Object executeTask(TaskManager tm, Task t, long timeout)
Executes the given Task, and returns the result - in the event that something
unexpected happens, an object of type UnusualResult is returned

The Task must not have been initialised

WARNING: This method shouldn't be invoked from within the code for a Task!


notifyDone

void notifyDone(Task child)
Invokes the appropriate doneX() method on this, given the child task
Parameters:
child - The child task that has completed

notifyDone

void notifyDone(Task child, Object result)
Invokes the appropriate doneX(Object) method on this, given the child task
Parameters:
child - The child task that has completed
result - The result associated with the complete child Task

notifyError

void notifyError(Task child, Throwable error)
Invoked by child-tasks to indicate that it has had an error
Parameters:
child - Child Task which had the error
error - The associated error exception

notifyTimeout

void notifyTimeout(Task child)
Invokes the appropriate timeoutX() method on this, given the child task
Parameters:
child - The child task that has timed-out

startTask

public void startTask()
Invoked when the task starts

Association Links

to Class fipaos.agent.task.Task

Child task we're monitoring

to Class java.lang.Object

Monitor lock - used to indicate when done

to Class java.lang.Object

Result of child task