@FunctionalInterface public interface AsyncCloseable
Examples of such resources are database connections, open file handles, socket descriptors
etc. While similar to AutoCloseable, this interface should be used when the resource
release operation may possibly be asynchronous. For example, if an object is thread-safe and
has many consumers, an implementation may require all current ongoing operations to complete
before resources are relinquished.
May be used with the methods Promises.tryApplyEx(CompletionStage, Function),
Promises.tryComposeEx(Promise, Function) to emulate the behavior of a try
with resources block.
| Modifier and Type | Method and Description |
|---|---|
CompletionStage<Void> |
close()
Release any resources associated with this object.
|
CompletionStage<Void> close()
CompletionStage that completes when all resources associated with this object
have been released, or settled with an exception if the resources cannot be released.Copyright © 2021. All rights reserved.