Class ClosingFuture.DeferredCloser
java.lang.Object
com.google.common.util.concurrent.ClosingFuture.DeferredCloser
- Enclosing class:
ClosingFuture<V extends @Nullable Object>
An object that can capture objects to be closed later, when a
ClosingFuture
pipeline is
done.- Since:
- 30.0
-
Method Summary
Modifier and TypeMethodDescription<C extends @Nullable Object & @Nullable AutoCloseable>
CeventuallyClose
(C closeable, Executor closingExecutor) Captures an object to be closed when aClosingFuture
pipeline is done.
-
Method Details
-
eventuallyClose
@CanIgnoreReturnValue public <C extends @Nullable Object & @Nullable AutoCloseable> C eventuallyClose(C closeable, Executor closingExecutor) Captures an object to be closed when aClosingFuture
pipeline is done.Be careful when targeting an older SDK than you are building against (most commonly when building for Android): Ensure that any object you pass implements the interface not just in your current SDK version but also at the oldest version you support. For example, API Level 28 is the first version in which
MediaDrm
isAutoCloseable
. To support older versions, pass a wrapperAutoCloseable
with a method reference likemediaDrm::release
.- Parameters:
closeable
- the object to be closedclosingExecutor
- the object will be closed on this executor- Returns:
- the first argument
-