ReleasableExecutor


@UnstableApi
interface ReleasableExecutor : Executor


An Executor with a dedicated release method to signal when it is not longer needed.

Summary

Public functions

java-static ReleasableExecutor!
<T : Executor?> from(executor: T!, releaseCallback: Consumer<T!>!)

Creates a ReleasableExecutor from an Executor and a release callback.

Unit

Releases the Executor, indicating that the caller no longer requires it for executing new commands.

Inherited functions

From java.util.concurrent.Executor

Public functions

from

java-static fun <T : Executor?> from(executor: T!, releaseCallback: Consumer<T!>!): ReleasableExecutor!

Creates a ReleasableExecutor from an Executor and a release callback.

Parameters
<T : Executor?>

The type of Executor.

executor: T!

The Executor

releaseCallback: Consumer<T!>!

The release callback, accepting the executor as an argument.

Returns
ReleasableExecutor!

The releasable executor.

release

fun release(): Unit

Releases the Executor, indicating that the caller no longer requires it for executing new commands.

When calling this method, there may still be pending commands that are currently executed.