SameThreadExecutorService

An ExecutorService that executes tasks immediately in the calling thread during submit.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val isShutdown: Boolean

Returns true if this executor has been shut down.

Link copied to clipboard
open override val isTerminated: Boolean

Returns true if all tasks have completed following shut down. Note that isTerminated is never true unless either shutdown or shutdownNow was called first.

Functions

Link copied to clipboard
open suspend override fun awaitTermination(timeout: Long, unit: TimeUnit): Boolean

Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.

Link copied to clipboard
open override fun close()

Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. This method waits until all tasks have completed execution and the executor has terminated.

Link copied to clipboard
open override fun execute(command: Runnable)
Link copied to clipboard
open suspend override fun <T> invokeAll(tasks: MutableCollection<Callable<T>>): MutableList<Future<T>>
open suspend override fun <T> invokeAll(tasks: MutableCollection<Callable<T>>, timeout: Long, unit: TimeUnit): MutableList<Future<T>>
Link copied to clipboard
open suspend override fun <T> invokeAny(tasks: MutableCollection<Callable<T>>): T?
open suspend override fun <T> invokeAny(tasks: MutableCollection<Callable<T>>, timeout: Long, unit: TimeUnit): T
Link copied to clipboard
fun <T> newTaskFor(callable: Callable<T>): RunnableFuture<T>

Returns a RunnableFuture for the given callable task.

fun <T> newTaskFor(runnable: Runnable, value: T?): RunnableFuture<T>

Returns a RunnableFuture for the given runnable and default value.

Link copied to clipboard
open override fun shutdown()

Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.

Link copied to clipboard
open suspend override fun shutdownNow(): MutableList<Runnable>

Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.

Link copied to clipboard
open override fun submit(task: Runnable): Future<*>
open override fun <T> submit(task: Callable<T>): Future<T>
open override fun <T> submit(task: Runnable, result: T): Future<T>