submit

abstract fun submit(task: Callable<V>): Future<V>

Submits a value-returning task for execution and returns a Future representing the pending results of the task. Upon completion, this task may be taken or polled.

Return

a Future representing pending completion of the task

Parameters

task

the task to submit

Throws

if the task cannot be scheduled for execution

if the task is null


abstract fun submit(task: Runnable, result: V): Future<V>

Submits a Runnable task for execution and returns a Future representing that task. Upon completion, this task may be taken or polled.

Return

a Future representing pending completion of the task, and whose get() method will return the given result value upon completion

Parameters

task

the task to submit

result

the result to return upon successful completion

Throws

if the task cannot be scheduled for execution

if the task is null