new SequencedExecutor()
Extends
Members
-
<protected, non-null> callbacks :Array.<function(boolean, ?string, Map.<string, *>)>
-
Type:
- Array.<function(boolean, ?string, Map.<string, *>)>
- Inherited From:
-
<protected> ended :boolean
-
Type:
- boolean
- Inherited From:
-
<protected, non-null> env :Map.<string, *>
-
Type:
- Map.<string, *>
- Inherited From:
-
<protected, nullable> errorMsg :string
-
Type:
- string
- Inherited From:
- Overrides:
-
<protected> logger :olympe.logging.Channel
-
Type:
- olympe.logging.Channel
- Inherited From:
-
<protected> started :boolean
-
Type:
- boolean
- Inherited From:
-
<protected, non-null> tasks :Array.<olympe.async.Task>
-
Type:
- Array.<olympe.async.Task>
- Inherited From:
Methods
-
<static> create()
-
Creates a
SequencedExecutorwith an auto-destructing context.Returns:
-
add(task)
-
Adds a task to this Executor. If the executor has already ended, this is ignored.
Parameters:
Name Type Description taskolympe.async.Task The task to add.
- Inherited From:
Returns:
this
Executor. -
<protected> clear()
-
Clears the executor: remove all tasks and callbacks.
- Inherited From:
-
<protected> complete(success)
-
Notifies the end of the execution and triggers the callbacks.
Parameters:
Name Type Description successboolean Whether the execution was successful or not.
- Inherited From:
-
getContext()
-
Gets the
ExecutionContextassociated with this Executor.- Inherited From:
Returns:
-
getLogger()
-
Gets the logger attached to this Executor.
- Inherited From:
Returns:
The attached logger.
- Type
- olympe.logging.Channel
-
hasEnded()
-
Checks whether this
Executorhas completed its execution.- Inherited From:
Returns:
truewhen theExecutorhas ended.- Type
- boolean
-
insert(task)
-
Inserts a task at the top of this
Executorslist. If the Executor has already started this means this tasks will be executed after the current one. If the Executor has already ended (all its tasks have already completed), the task is ignored.Parameters:
Name Type Description taskolympe.async.Task The task to insert.
Returns:
this Executor
-
isRunning()
-
Checks whether this
Executoris currently running one or more tasks.- Inherited From:
Returns:
truewhen theExecutoris running.- Type
- boolean
-
onEnd(callback)
-
Registers a callback to be called when the Executor has completed. The callback is passed a boolean,
trueif all the tasks completed successfully,falseotherwise.Parameters:
Name Type Description callbackfunction The function to register.
- Inherited From:
Returns:
this
Executor. -
start()
-
Starts the executor. Does nothing if it had already been started.
- Inherited From:
- Overrides:
-
withLogger(logger)
-
Attach a logger to this executor.
Parameters:
Name Type Description loggerolympe.logging.Channel The logger to attach.
- Inherited From:
Returns:
this
Executor. -
withTimeout(t)
-
Sets a timeout for the executor. If all the tasks in this
Executorare not completed within the specified time the Executor will complete asfailed. All pending tasks will be cancelled.Parameters:
Name Type Description tnumber timeout in milliseconds.
- Inherited From:
Returns:
this
Executor.
Olympe SDK