On this page
Object ExecutionContext.parasitic
object parasitic extends ExecutionContextExecutor
WARNING: Only ever execute logic which will quickly return control to the caller.
This ExecutionContext
steals execution time from other threads by having its Runnable
s run on the Thread
which calls execute
and then yielding back control to the caller after *all* its Runnable
s have been executed. Nested invocations of execute
will be trampolined to prevent uncontrolled stack space growth.
When using parasitic
with abstractions such as Future
it will in many cases be non-deterministic as to which Thread
will be executing the logic, as it depends on when/if that Future
is completed.
Do *not* call any blocking code in the Runnable
s submitted to this ExecutionContext
as it will prevent progress by other enqueued Runnable
s and the calling Thread
.
Symptoms of misuse of this ExecutionContext
include, but are not limited to, deadlocks and severe performance problems.
Any NonFatal
or InterruptedException
s will be reported to the defaultReporter
.
Supertypes | |
---|---|
Self type |
Concrete methods
Source
Runs a block of code on this execution context.
Value parameters |
|
---|---|
Definition Classes | Executor -> ExecutionContext |
Source
Reports that an asynchronous computation failed. See ExecutionContext.reportFailure(throwable: Throwable)
Definition Classes | BatchingExecutor -> ExecutionContext |
---|
Source
MUST throw a NullPointerException when runnable
is null When implementing a sync BatchingExecutor, it is RECOMMENDED to implement this method as runnable.run()
Definition Classes | BatchingExecutor |
---|
Inherited methods
Source
WARNING: Never use both submitAsyncBatched
and submitSyncBatched
in the same implementation of BatchingExecutor
Inherited from | BatchingExecutor (hidden) |
---|
Source
WARNING: Never use both submitAsyncBatched
and submitSyncBatched
in the same implementation of BatchingExecutor
Inherited from | BatchingExecutor (hidden) |
---|
© 2002-2022 EPFL, with contributions from Lightbend.
Licensed under the Apache License, Version 2.0.
https://scala-lang.org/api/3.2.0/scala/concurrent/ExecutionContext$$parasitic$.html