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!
Executor?> from(executor: T!, releaseCallback: Consumer!)

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 Executor?> from(executor: T!, releaseCallback: Consumer!): ReleasableExecutor!

Creates a ReleasableExecutor from an Executor and a release callback.

Parameters
Executor?>

The type of Executor.

executor: T!

The Executor

releaseCallback: Consumer!

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.