poll

abstract fun poll(): Future<V>?

Retrieves and removes the Future representing the next completed task, or null if none are present.

Return

the Future representing the next completed task, or null if none are present


abstract suspend fun poll(timeout: Long, unit: TimeUnit): Future<V>?

Retrieves and removes the Future representing the next completed task, waiting if necessary up to the specified wait time if none are yet present.

Return

the Future representing the next completed task or null if the specified waiting time elapses before one is present

Parameters

timeout

how long to wait before giving up, in units of unit

unit

a TimeUnit determining how to interpret the timeout parameter

Throws

if interrupted while waiting