Interface ListenableAsyncCloseable

All Superinterfaces:
AsyncCloseable
All Known Subinterfaces:
ClientGroup<Key,Client>, ConnectionContext, ConnectionFactory<ResolvedAddress,C>, EventLoopAwareNettyIoExecutor, Executor, FilterableReservedStreamingHttpConnection, FilterableStreamingHttpClient, FilterableStreamingHttpConnection, FilterableStreamingHttpLoadBalancedConnection, GrpcClient<BlockingClient>, GrpcClientCallFactory, GrpcServerContext, GrpcServiceContext, Health.HealthClient, HttpClient, HttpConnection, HttpConnectionContext, HttpRequester, HttpServerContext, IoExecutor, LoadBalancedAddress<C>, LoadBalancedConnection, LoadBalancer<C>, NettyConnection<Read,Write>, NettyConnectionContext, NettyIoExecutor, PartitionMap<T>, ReservedHttpConnection, ReservedStreamingHttpConnection, ServerContext, ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>, StreamingHttpClient, StreamingHttpConnection, StreamingHttpRequester
All Known Implementing Classes:
ChannelSet, DefaultNettyConnection, DefaultPartitionedClientGroup, DelegatingConnectionContext, DelegatingConnectionFactory, DelegatingExecutor, DelegatingFilterableStreamingHttpLoadBalancedConnection, DelegatingHttpConnectionContext, DelegatingHttpServiceContext, DelegatingServiceDiscoverer, HttpLoadBalancerFactory.DefaultFilterableStreamingHttpLoadBalancedConnection, HttpServiceContext, NettyChannelListenableAsyncCloseable, NettyPipelinedConnection, NettyServerContext, PowerSetPartitionMap, ReservedStreamingHttpConnectionFilter, StreamingHttpClientFilter, StreamingHttpConnectionFilter

public interface ListenableAsyncCloseable extends AsyncCloseable
Provides a way to subscribe when AsyncCloseable.closeAsync() is completed.
  • Method Details

    • onClose

      Completable onClose()
      Returns a Completable that is notified once the ListenableAsyncCloseable was closed.
      Returns:
      the Completable that is notified on close.
    • onClosing

      default Completable onClosing()
      Returns a Completable that is notified when closing begins.

      Closing begin might be when a close operation is initiated locally (e.g. subscribing to AsyncCloseable.closeAsync()) or it could also be a transport event received from a remote peer (e.g. read a connection: close header).

      For backwards compatibility this method maybe functionally equivalent to onClose(). Therefore, provides a best-effort leading edge notification of closing, but may fall back to notification on trailing edge.

      The goal of this method is often to notify asap when closing so this method may not be offloaded and care must be taken to avoid blocking if subscribing to the return Completable.

      Returns:
      a Completable that is notified when closing begins.