JobFuture

Wraps a job closure in a future. The job is not invoked until await is called. The jobInput is passed as the only argument to job.

class JobFuture<T, V>(job: (T) -> V, jobInput: T) : Future<V>

Parameters

T

the type of the job

V

the output of the job

Constructors

JobFuture
Link copied to clipboard
common

the type of the job

fun <T, V> JobFuture(job: (T) -> V, jobInput: T)

Functions

await
Link copied to clipboard
common

Consume the future value in code as input. This method may or may not block the calling thread depending upon the implementation.

Examples

val future: Future<T> = // some api which returns a Future<T>
val value: R = future.await() // blocks until future completes

open override fun await(): V
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

isCompleted
Link copied to clipboard
common

Returns true if the future has completed and is ready to await.

open override var isCompleted: Boolean
job
Link copied to clipboard
common

the job to be executed in future

val job: (T) -> V
jobInput
Link copied to clipboard
common

the only argument passed to the job

val jobInput: T