Interface AsyncCloseable

All Superinterfaces:
AutoCloseable
All Known Subinterfaces:
ClientFactory, EndpointGroup, ListenableAsyncCloseable
All Known Implementing Classes:
AsyncCloseableSupport, ConsulEndpointGroup, DecoratingClientFactory, DnsAddressEndpointGroup, DnsServiceEndpointGroup, DnsTextEndpointGroup, DynamicEndpointGroup, Endpoint, EurekaEndpointGroup, HealthCheckedEndpointGroup, PropertiesEndpointGroup, Server, StartStopSupport, XdsEndpointGroup, 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
    Releases any underlying resources held by this object synchronously.
    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