Interface AsyncCloseable

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ClientFactory, EndpointGroup, ListenableAsyncCloseable
All Known Implementing Classes:
AsyncCloseableSupport, DecoratingClientFactory, DnsAddressEndpointGroup, DnsServiceEndpointGroup, DnsTextEndpointGroup, DynamicEndpointGroup, Endpoint, EurekaEndpointGroup, HealthCheckedEndpointGroup, PropertiesEndpointGroup, Server, StartStopSupport, ZooKeeperEndpointGroup

public interface AsyncCloseable
extends AutoCloseable
An object that may hold resources until it is closed. In addition to AutoCloseable.close(), this interface provides closeAsync() which releases the resources asynchronously, returning a CompletableFuture which is completed after the resources are released.
  • Method Summary

    Modifier and Type Method Description
    void close()
    Releases any underlying resources held by this object synchronously.
    CompletableFuture<?> closeAsync()
    Releases any underlying resources held by this object asynchronously.
  • Method Details

    • closeAsync

      CompletableFuture<?> closeAsync()
      Releases any underlying resources held by this object asynchronously.
      Returns:
      the CompletableFuture which is completed after the resources are released
    • close

      void close()
      Releases any underlying resources held by this object synchronously.
      Specified by:
      close in interface AutoCloseable