V
- the type of the value of a successful operationpublic static final class ClosingFuture.ValueAndCloser<V> extends Object
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.
Modifier and Type | Method and Description |
---|---|
void |
closeAsync()
Starts closing all closeable objects captured during the
ClosingFuture 's asynchronous
operation on the Executor s specified by calls to DeferredCloser#eventuallyClose(Closeable, Executor) . |
V |
get()
Returns the final value of the associated
ClosingFuture , or throws an exception as
Future.get() would. |
public V get() throws ExecutionException
ClosingFuture
, or throws an exception as
Future.get()
would.
Because the asynchronous operation has already completed, this method is synchronous and returns immediately.
CancellationException
- if the computation was cancelledExecutionException
- if the computation threw an exceptionpublic void closeAsync()
ClosingFuture
's asynchronous
operation on the Executor
s 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.
Copyright © 2010–2021. All rights reserved.