Something that runs a task now or later, so that the code handing it over does not have to wait.
The framework uses it to run event listeners away from the publishing
call: @Async listeners run on a TaskExecutor bean, and
SimpleApplicationEventMulticaster(taskExecutor: ...) runs every
listener on one. Declaring a TaskExecutor bean is also what switches
@Async on; the scheduling starter declares one. Dart has no threads
here: an asynchronous executor runs the task in a later event-loop turn
of the same isolate (SimpleAsyncTaskExecutor). Implement it to run
tasks elsewhere, for example in another isolate.
final TaskExecutor executor = SimpleAsyncTaskExecutor();
executor.execute(() => log.info('later'));
log.info('now'); // logged first
Spring (Java):
TaskExecutor executor = new SimpleAsyncTaskExecutor();
executor.execute(() -> log.info("later"));
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
execute(
FutureOr< void> task()) → void -
Runs
task, now or later depending on the implementation; a returnedFuturecounts as the rest of the task. Returns at once for an asynchronous executor. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited