public interface AsyncAutoCloseable extends AutoCloseable
For convenience, this extends the JDK's AutoCloseable in order to be usable in
try-with-resource blocks (in that case, the blocking close() will be used).
| Modifier and Type | Method and Description |
|---|---|
default void |
close() |
CompletionStage<Void> |
closeAsync()
Initiates an orderly shutdown: no new requests are accepted, but all pending requests are
allowed to complete normally.
|
CompletionStage<Void> |
closeFuture()
Returns a stage that will complete when
close() or forceCloseAsync() is
called, and the shutdown sequence completes. |
CompletionStage<Void> |
forceCloseAsync()
Initiates a forced shutdown of this instance: no new requests are accepted, and all pending
requests will complete with an exception.
|
default boolean |
isClosed()
Whether shutdown has completed.
|
@NonNull CompletionStage<Void> closeFuture()
close() or forceCloseAsync() is
called, and the shutdown sequence completes.default boolean isClosed()
This is a shortcut for closeFuture().toCompletableFuture().isDone().
@NonNull CompletionStage<Void> closeAsync()
forceCloseAsync() always return the same instance.@NonNull CompletionStage<Void> forceCloseAsync()
close() always return the same instance.default void close()
This method is implemented by calling closeAsync() and blocking on the result. This
should not be called on a driver thread.
close in interface AutoCloseableCopyright © 2017–2019. All rights reserved.