DispatchQueue

trait DispatchQueue extends ExecutionContext

A thin wrapper over Scala's ExecutionContext allowing us to differentiate between the default execution context which tries to run asynchronously as many tasks as possible, and limited execution contexts, allowed to run only up to a given number of tasks at once.

A thin wrapper over Scala's ExecutionContext allowing us to differentiate between the default execution context which tries to run asynchronously as many tasks as possible, and limited execution contexts, allowed to run only up to a given number of tasks at once.

See also

ExecutionContext

Companion
object
trait ExecutionContext
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[A](task: => A): CancellableFuture[A]

Executes a task on this queue. You can use this to execute a piece of code on another dispatch queue than the one default to the parent code block, i.e.

Executes a task on this queue. You can use this to execute a piece of code on another dispatch queue than the one default to the parent code block, i.e.

... // running on Threading.defaultContext
UiDispatchQueue.Ui {
 ... // this will run on the UI thread
}
...
Type Params
A

the type of the task result

Value Params
task

an operation to perform on this queue.

Returns

a cancellable future which will finish with the result of the task

def hasRemainingTasks: Boolean

If the queue is a limited one, some tasks may need to wait before being executed.

If the queue is a limited one, some tasks may need to wait before being executed.

Returns

true if there is a task waiting in the queue to be executed after one of the current one finishes, false otherwise.

override def reportFailure(t: Throwable): Unit
Value Params
t
  • the error that occured when executing a task on this queue.
Todo

Currently not used. Left here as a reminder that in the future we may provide logging functionality.

Definition Classes
ExecutionContext

Inherited methods

def execute(runnable: Runnable): Unit
Inherited from
ExecutionContext

Deprecated and Inherited methods

@deprecated("preparation of ExecutionContexts will be removed", "2.12.0")
def prepare(): ExecutionContext
Deprecated
Inherited from
ExecutionContext

Concrete fields

val name: String