GuestExecutor

interface GuestExecutor : ListeningExecutorService, ScheduledExecutorService, CoroutineContext

Guest Executor

Defines the API surface made available, and expected, for guest execution management; a guest executor is provided for host-side use, in the execution of guest code, which should be background-invoked by a guest runtime.

For example, when using async methods via Node APIs (like the fs) module, execution of method logic takes place on a GuestExecutor instance, which may manage context switching for the polyglot runtime as needed.

APIs that originate promise objects work this way too, executing on the GuestExecutor when their value is awaited.

 

Executor Services

Guest executors are, firstly, Executor instances; depending on the implementation assigned, execution may take place in a background thread or in the calling thread (for instance, during testing).

In "production," the executor service is typically multithreaded, and equipped with context lock management.

 

Coroutine Scope and Context

In addition to the Executor API, the GuestExecutor interface extends CoroutineScope, providing a bridge to the Kotlin Coroutines API.

Co-routine scope may be enclosed to provide context for host-side execution.

Properties

Link copied to clipboard
abstract val dispatcher: CoroutineDispatcher

Functions

Link copied to clipboard
open fun awaitTermination(timeout: Duration): Boolean
abstract fun awaitTermination(p0: Long, p1: TimeUnit): Boolean
Link copied to clipboard
open override fun close()
Link copied to clipboard
abstract fun execute(p0: Runnable)
Link copied to clipboard
abstract fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
Link copied to clipboard
abstract operator fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
Link copied to clipboard
abstract override fun <T> invokeAll(tasks: MutableCollection<out Callable<T>>): MutableList<Future<T>>
open fun <T> invokeAll(tasks: MutableCollection<out Callable<T>>, timeout: Duration): MutableList<Future<T>>
abstract override fun <T> invokeAll(tasks: MutableCollection<out Callable<T>>, timeout: Long, unit: TimeUnit): MutableList<Future<T>>
Link copied to clipboard
open fun <T> invokeAny(tasks: MutableCollection<out Callable<T>>, timeout: Duration): T & Any
abstract fun <T : Any> invokeAny(p0: MutableCollection<out Callable<T>>): T
abstract fun <T : Any> invokeAny(p0: MutableCollection<out Callable<T>>, p1: Long, p2: TimeUnit): T
Link copied to clipboard
abstract fun isShutdown(): Boolean
Link copied to clipboard
abstract fun isTerminated(): Boolean
Link copied to clipboard
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext
Link copied to clipboard
abstract fun schedule(p0: Runnable, p1: Long, p2: TimeUnit): ScheduledFuture<*>
abstract fun <V : Any> schedule(p0: Callable<V>, p1: Long, p2: TimeUnit): ScheduledFuture<V>
Link copied to clipboard
abstract fun scheduleAtFixedRate(p0: Runnable, p1: Long, p2: Long, p3: TimeUnit): ScheduledFuture<*>
Link copied to clipboard
abstract fun scheduleWithFixedDelay(p0: Runnable, p1: Long, p2: Long, p3: TimeUnit): ScheduledFuture<*>
Link copied to clipboard
abstract fun shutdown()
Link copied to clipboard
Link copied to clipboard
abstract override fun submit(task: Runnable): ListenableFuture<*>
abstract override fun <T> submit(task: Callable<T>): ListenableFuture<T>
abstract override fun <T> submit(task: Runnable, result: T): ListenableFuture<T>