Packagecom.rosettastone.library.taskmanager
Classpublic class TaskManager
InheritanceTaskManager Inheritance AbstractTaskManager Inheritance Task Inheritance flash.events.EventDispatcher

Manages execution of a set of ITasks. Tasks may specify blocking depencies on other tasks. This class will wrap all TaskEvents and dispatch TaskManagerEvent.COMPLETE only once all Tasks have completed. If a task errors, this class will dispatch a TaskManagerEvent.ERROR event and halt running any additional tasks.



Public Properties
 PropertyDefined By
 Inheritedcompleted : Boolean
[read-only] There are no pending or active Tasks.
AbstractTaskManager
 Inheriteddata : *
[read-only] Optional data parameter passed to the Task complete/error/interruption method.
Task
 InheritederrorDatas : Array
[read-only] Error datas from all inner Tasks that failed during execution.
AbstractTaskManager
 InheritederroredTasks : Array
[read-only] Tasks that errored during execution.
AbstractTaskManager
 InheritederrorMessages : Array
[read-only] Unique error messages from all inner Tasks that failed during execution.
AbstractTaskManager
 Inheritedid : Number
[read-only]
Task
 Inheritedinterruptible : Boolean
[override] [read-only] The current Task can be interrupted.
AbstractTaskManager
 InheritedinterruptingTask : ITask
[read-only] The Task currently interrupting the composite Task's execution (or NULL if no such Task exists).
Task
 InheritedisComplete : Boolean
[read-only] The current task has successfully completed execution.
Task
 InheritedisErrored : Boolean
[read-only] The current task failed.
Task
 InheritedisInterrupted : Boolean
[read-only]
Task
 InheritedisRunning : Boolean
[read-only] The task is currently running.
Task
 Inheritedmessage : String
[read-only] Optional message parameter passed to the task complete/error/interruption method.
Task
 InheritednumCompletedTasks : int
[read-only] Number of Tasks that have successfully completed execution.
AbstractTaskManager
 InheritednumInternalOperations : int
[override] [read-only] Number of internal operations conducted by this task.
AbstractTaskManager
 InheritednumInternalOperationsCompleted : int
[override] [read-only] Number of internal operations that have completed.
AbstractTaskManager
 InheritednumInternalOperationsPending : int
[read-only] Number of internal operations not yet completed.
Task
 InheritednumTasks : int
[read-only] Number of Tasks to be executed by TaskManager.
AbstractTaskManager
 InheritednumTimesCompleted : int
[read-only] Number of times this task has completed.
Task
 InheritednumTimesErrored : int
[read-only] Number of times this task has errored.
Task
 InheritednumTimesInterrupted : int
[read-only] Number of times this task has been interrupted.
Task
 InheritednumTimesReset : int
[read-only] Number of times this task has been reset.
Task
 InheritednumTimesStarted : int
[read-only] Number of times this task has been started.
Task
 Inheritedrunning : Boolean
[read-only] The task is currently running.
Task
 Inheritedsynchronous : Boolean
[override] [read-only] The current task can be executed synchronously.
AbstractTaskManager
 InheritedtaskIdentifier : String
(Optional) human-readable label for task.
Task
 InheriteduniqueID : Number
[read-only] Unique ID for a task.
Task
Protected Properties
 PropertyDefined By
 Inheritedlogger : ILogger
[read-only] Instance of ILogger to be used for any custom Task logging.
Task
Public Methods
 MethodDefined By
  
TaskManager(interruptible:Boolean = false)
Constructor.
TaskManager
  
addTask(task:ITask, dependencies:Array = null):void
Adds a task to the graph and set its dependencies.
TaskManager
 Inherited
and(... chainedTasks):ITask
Executes the specified tasks when the current task is executed.
Task
 Inherited
Task
 Inherited
interrupt():Boolean
[override] Interruptible tasks should override interrupt() and get interruptible() if they are interruptible.
AbstractTaskManager
 Inherited
interruptForTask(interruptingTask:ITask):Boolean
Interrupts the current Task to wait on the Task specified.
Task
 Inherited
or(... chainedTasks):ITask
Executes the specified tasks if the current task fails.
Task
  
removeTask(taskToRemove:ITask):void
Removes a task from the task manager.
TaskManager
 Inherited
reset():void
Resets the task to it's pre-run state.
Task
 Inherited
Starts a task.
Task
 Inherited
then(... chainedTasks):ITask
Executes the specified tasks once the current task has completed successfully.
Task
 Inherited
withCompleteHandler(completeHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate completion, this method may also be used for notification purposes.
Task
 Inherited
withErrorHandler(errorHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate failure, this method may also be used for notification purposes.
Task
 Inherited
withFinalHandler(finalHandler:Function):ITask
This handler is invoked upon either success or failure of the Task.
Task
 Inherited
withInterruptionHandler(interruptionHandler:Function):ITask
Task
 Inherited
withStartedHandler(startedHandler:Function):ITask
Although tasks dispatch TaskEvents to indicate starting, this method may also be used for notification purposes.
Task
Protected Methods
 MethodDefined By
 Inherited
addTaskHelper(task:ITask, dependencies:Array = null):void
Adds a task to the graph and set its dependencies.
AbstractTaskManager
 Inherited
[override] Override this method to perform any custom reset operations.
AbstractTaskManager
 Inherited
customRun():void
[override] Override this method to give your Task functionality.
AbstractTaskManager
 Inherited
Task
 Inherited
getLoggerString(string:String):String
Returns a string for logging the specified task-state event.
Task
 Inherited
removeTaskHelper(taskToRemove:ITask):void
Removes a task from the task manager.
AbstractTaskManager
 Inherited
taskComplete(message:String, data:* = null):void
This method should be called upon Task completion.
Task
 Inherited
taskError(message:String, data:* = null):void
This method should be called upon Task failure.
Task
 Inherited
taskInterrupted(message:String, data:* = null):void
Call this method to interrupt the currently running Task.
Task
 Inherited
Task
Events
 Event Summary Defined By
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
 InheritedTask
  TaskManager
  TaskManager
  TaskManager
Constructor Detail
TaskManager()Constructor
public function TaskManager(interruptible:Boolean = false)

Constructor.

Parameters
interruptible:Boolean (default = false) — Consider using InterruptibleTaskManager instead of this parameter.
Method Detail
addTask()method
public function addTask(task:ITask, dependencies:Array = null):void

Adds a task to the graph and set its dependencies. If TaskManager is currently running and the specified Taks has invalid dependencies, an ERROR event will be dispatched immediately.

Parameters

task:ITask — Task to add to TaskManager
 
dependencies:Array (default = null) — Array of Tasks that newly added Task depends on


Throws
Error — if TaskManager has been configured for interruptible-mode and Task is not either interruptible or synchronous
removeTask()method 
public function removeTask(taskToRemove:ITask):void

Removes a task from the task manager. If the TaskManager is running and this operation unblocks any of the remaining Tasks, they will be executed as a result of this removal.

Parameters

taskToRemove:ITask — The task to remove

Event Detail
taskManagerEventComplete Event
Event Object Type: com.rosettastone.library.taskmanager.events.TaskManagerEvent

taskManagerEventError Event  
Event Object Type: com.rosettastone.library.taskmanager.events.TaskManagerEvent

taskManagerEventInterrupted Event  
Event Object Type: com.rosettastone.library.taskmanager.events.TaskManagerEvent