Class ClosingFuture.DeferredCloser
- java.lang.Object
-
- com.google.common.util.concurrent.ClosingFuture.DeferredCloser
-
- Enclosing class:
- ClosingFuture<V extends @Nullable java.lang.Object>
public static final class ClosingFuture.DeferredCloser extends java.lang.Object
An object that can capture objects to be closed later, when aClosingFuturepipeline is done.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <C extends @Nullable java.lang.Object & @Nullable java.lang.AutoCloseable>
CeventuallyClose(C closeable, java.util.concurrent.Executor closingExecutor)Captures an object to be closed when aClosingFuturepipeline is done.
-
-
-
Method Detail
-
eventuallyClose
@CanIgnoreReturnValue public <C extends @Nullable java.lang.Object & @Nullable java.lang.AutoCloseable> C eventuallyClose(C closeable, java.util.concurrent.Executor closingExecutor)
Captures an object to be closed when aClosingFuturepipeline 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
MediaDrmisAutoCloseable. To support older versions, pass a wrapperAutoCloseablewith a method reference likemediaDrm::release.- Parameters:
closeable- the object to be closedclosingExecutor- the object will be closed on this executor- Returns:
- the first argument
-
-