parasitic

scala.concurrent.ExecutionContext$.parasitic$

WARNING: Only ever execute logic which will quickly return control to the caller.

This ExecutionContext steals execution time from other threads by having its Runnables run on the Thread which calls execute and then yielding back control to the caller after *all* its Runnables 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 Runnables submitted to this ExecutionContext as it will prevent progress by other enqueued Runnables and the calling Thread.

Symptoms of misuse of this ExecutionContext include, but are not limited to, deadlocks and severe performance problems.

Any NonFatal or InterruptedExceptions will be reported to the defaultReporter.

Attributes

Source
ExecutionContext.scala
Graph
Supertypes
trait Executor
class Object
trait Matchable
class Any
Show all
Self type
parasitic.type

Members list

Value members

Concrete methods

final override def execute(runnable: Runnable): Unit

Runs a block of code on this execution context.

Runs a block of code on this execution context.

Value parameters

runnable

the task to execute

Attributes

Definition Classes
Source
ExecutionContext.scala
final override def reportFailure(t: Throwable): Unit

Reports that an asynchronous computation failed.

Reports that an asynchronous computation failed. See ExecutionContext.reportFailure(throwable: Throwable)

Attributes

Definition Classes
BatchingExecutor -> ExecutionContext
Source
ExecutionContext.scala
final override def submitForExecution(runnable: Runnable): Unit

MUST throw a NullPointerException when runnable is null When implementing a sync BatchingExecutor, it is RECOMMENDED to implement this method as runnable.run()

MUST throw a NullPointerException when runnable is null When implementing a sync BatchingExecutor, it is RECOMMENDED to implement this method as runnable.run()

Attributes

Definition Classes
BatchingExecutor
Source
ExecutionContext.scala

Inherited methods

final protected def submitAsyncBatched(runnable: Runnable): Unit

WARNING: Never use both submitAsyncBatched and submitSyncBatched in the same implementation of BatchingExecutor

WARNING: Never use both submitAsyncBatched and submitSyncBatched in the same implementation of BatchingExecutor

Attributes

Inherited from:
BatchingExecutor (hidden)
Source
BatchingExecutor.scala
final protected def submitSyncBatched(runnable: Runnable): Unit

WARNING: Never use both submitAsyncBatched and submitSyncBatched in the same implementation of BatchingExecutor

WARNING: Never use both submitAsyncBatched and submitSyncBatched in the same implementation of BatchingExecutor

Attributes

Inherited from:
BatchingExecutor (hidden)
Source
BatchingExecutor.scala

Deprecated and Inherited methods

Prepares for the execution of a task.

Prepares for the execution of a task. Returns the prepared execution context. The recommended implementation of prepare is to return this.

This method should no longer be overridden or called. It was originally expected that prepare would be called by all libraries that consume ExecutionContexts, in order to capture thread local context. However, this usage has proven difficult to implement in practice and instead it is now better to avoid using prepare entirely.

Instead, if an ExecutionContext needs to capture thread local context, it should capture that context when it is constructed, so that it doesn't need any additional preparation later.

Attributes

Deprecated
true
Inherited from:
ExecutionContext
Source
ExecutionContext.scala