# ReleasableExecutor

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/util/ReleasableExecutor.java+class:androidx.media3.exoplayer.util.ReleasableExecutor)

*** ** * ** ***


```
@UnstableApi
interface ReleasableExecutor : Executor
```

<br />

*** ** * ** ***

An `https://developer.android.com/reference/java/util/concurrent/Executor.html` with a dedicated `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor#release()` method to signal when it is not longer needed.

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor!` | `<T : https://developer.android.com/reference/java/util/concurrent/Executor.html?> https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor#from(T,java.util.function.Consumer<T>)(executor: T!, releaseCallback: https://developer.android.com/reference/java/util/function/Consumer.html<T!>!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor` from an `https://developer.android.com/reference/java/util/concurrent/Executor.html` and a release callback. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor#release()()` Releases the `https://developer.android.com/reference/java/util/concurrent/Executor.html`, indicating that the caller no longer requires it for executing new commands. |

### Inherited functions

From [java.util.concurrent.Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/java/util/concurrent/Executor.html#execute(java.lang.Runnable)(p: https://developer.android.com/reference/java/lang/Runnable.html!)`

## Public functions

### from

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

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor` from an `https://developer.android.com/reference/java/util/concurrent/Executor.html` and a release callback.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/java/util/concurrent/Executor.html?>` | The type of `https://developer.android.com/reference/java/util/concurrent/Executor.html`. |
| `executor: T!` | The `https://developer.android.com/reference/java/util/concurrent/Executor.html` |
| `releaseCallback: https://developer.android.com/reference/java/util/function/Consumer.html<T!>!` | The release callback, accepting the `executor` as an argument. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/util/ReleasableExecutor!` | The releasable executor. |

### release

```
fun release(): Unit
```

Releases the `https://developer.android.com/reference/java/util/concurrent/Executor.html`, 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.