Class ClosingFuture.DeferredCloser

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <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 a ClosingFuture pipeline is done.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 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