# CountDownFuture

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

*** ** * ** ***


```
@UnstableApi
public final class CountDownFuture extends AbstractFuture<Void>
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | com.google.common.util.concurrent.internal.InternalFutureFailureAccess |||
|   | ↳ | [com.google.common.util.concurrent.AbstractFuture](https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html)\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> ||
|   |   | ↳ | [androidx.media3.test.utils.CountDownFuture](https://developer.android.com/reference/androidx/media3/test/utils/CountDownFuture) |

*** ** * ** ***

A `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when `https://developer.android.com/reference/androidx/media3/test/utils/CountDownFuture#countDown()` has been called a specified number of times.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/CountDownFuture#CountDownFuture(int)(int count)` Creates an instance initialized with the specified count. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/CountDownFuture#countDown()()` Decrements the remaining count, completing the future when it reaches 0. |

### Inherited methods

From [com.google.common.util.concurrent.AbstractFuture](https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html) `void` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#addListener(java.lang.Runnable, java.util.concurrent.Executor)(https://developer.android.com/reference/java/lang/Runnable.html listener, https://developer.android.com/reference/java/util/concurrent/Executor.html executor)` `void` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#afterDone()()` `boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#cancel(boolean)(boolean mayInterruptIfRunning)` `V` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#get(long, java.util.concurrent.TimeUnit)(long timeout, https://developer.android.com/reference/java/util/concurrent/TimeUnit.html unit)` `void` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#interruptTask()()` `boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#isCancelled()()` `boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#isDone()()` `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#pendingToString()()` `boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#set(V)(V value)` `boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#setException(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html throwable)` `boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#setFuture(com.google.common.util.concurrent.ListenableFuture&lt;? extends V&gt;)(https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<V> future)` `https://developer.android.com/reference/java/lang/String.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#toString()()` `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Throwable.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#tryInternalFastPathGetFailure()()` `final boolean` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#wasInterrupted()()` From [java.util.concurrent.Future](https://developer.android.com/reference/java/util/concurrent/Future.html) `https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/util/concurrent/Future.html#exceptionNow()()` `V` `https://developer.android.com/reference/java/util/concurrent/Future.html#resultNow()()` `https://developer.android.com/reference/java/util/concurrent/Future.State.html` `https://developer.android.com/reference/java/util/concurrent/Future.html#state()()`

## Public constructors

### CountDownFuture

```
public CountDownFuture(int count)
```

Creates an instance initialized with the specified count.

| Parameters |
|---|---|
| `int count` | The number of times `https://developer.android.com/reference/androidx/media3/test/utils/CountDownFuture#countDown()` must be invoked before completing. If 0, the future completes immediately. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if count is negative. |

## Public methods

### countDown

```
public void countDown()
```

Decrements the remaining count, completing the future when it reaches 0.