Class ClosingFuture.ValueAndCloser<V extends @Nullable Object>

java.lang.Object
com.google.common.util.concurrent.ClosingFuture.ValueAndCloser<V>
Type Parameters:
V - the type of the value of a successful operation
Enclosing class:
ClosingFuture<V extends @Nullable Object>

public static final class ClosingFuture.ValueAndCloser<V extends @Nullable Object> extends Object
An object that holds the final result of an asynchronous ClosingFuture operation and allows the user to close all the closeable objects that were captured during it for later closing.

The asynchronous operation will have completed before this object is created.

See Also:
  • Method Details

    • get

      public V get() throws ExecutionException
      Returns the final value of the associated ClosingFuture, or throws an exception as Future.get() would.

      Because the asynchronous operation has already completed, this method is synchronous and returns immediately.

      Throws:
      CancellationException - if the computation was cancelled
      ExecutionException - if the computation threw an exception
    • closeAsync

      public void closeAsync()
      Starts closing all closeable objects captured during the ClosingFuture's asynchronous operation on the Executors specified by calls to DeferredCloser#eventuallyClose(Closeable, Executor).

      If any such calls specified MoreExecutors.directExecutor(), those objects will be closed synchronously.

      Idempotent: objects will be closed at most once.