Class ClosingFuture.DeferredCloser

java.lang.Object
com.google.common.util.concurrent.ClosingFuture.DeferredCloser
Enclosing class:
ClosingFuture<V extends @Nullable Object>

public static final class ClosingFuture.DeferredCloser extends Object
An object that can capture objects to be closed later, when a ClosingFuture pipeline is done.
Since:
30.0
  • Method Details

    • eventuallyClose

      @CanIgnoreReturnValue public <C extends @Nullable Object & @Nullable AutoCloseable> C eventuallyClose(C closeable, Executor closingExecutor)
      Captures an object to be closed when a ClosingFuture 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 is AutoCloseable. To support older versions, pass a wrapper AutoCloseable with a method reference like mediaDrm::release.

      Parameters:
      closeable - the object to be closed
      closingExecutor - the object will be closed on this executor
      Returns:
      the first argument