Package io.servicetalk.concurrent.api
Class DelegatingListenableAsyncCloseable<T extends ListenableAsyncCloseable>
java.lang.Object
io.servicetalk.concurrent.api.DelegatingAsyncCloseable<T>
io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable<T>
- Type Parameters:
T- The type ofListenableAsyncCloseableto delegate to.
- All Implemented Interfaces:
AsyncCloseable,ListenableAsyncCloseable
- Direct Known Subclasses:
DelegatingConnectionContext,DelegatingConnectionFactory,DelegatingExecutor,DelegatingFilterableStreamingHttpLoadBalancedConnection,DelegatingServiceDiscoverer
public class DelegatingListenableAsyncCloseable<T extends ListenableAsyncCloseable>
extends DelegatingAsyncCloseable<T>
implements ListenableAsyncCloseable
ListenableAsyncCloseable that delegates all calls to another ListenableAsyncCloseable.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Tdelegate()Get theDelegatingListenableAsyncCloseablesubtype ofListenableAsyncCloseablethat this class delegates to.onClose()Returns aCompletablethat is notified once theListenableAsyncCloseablewas closed.Returns aCompletablethat is notified when closing begins.Methods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefully, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
-
Constructor Details
-
DelegatingListenableAsyncCloseable
New instance.- Parameters:
delegate-DelegatingListenableAsyncCloseablesubtype ofListenableAsyncCloseableto delegate all calls to.
-
-
Method Details
-
delegate
Get theDelegatingListenableAsyncCloseablesubtype ofListenableAsyncCloseablethat this class delegates to.- Overrides:
delegatein classDelegatingAsyncCloseable<T extends ListenableAsyncCloseable>- Returns:
- the
DelegatingListenableAsyncCloseablesubtype ofListenableAsyncCloseablethat this class delegates to.
-
onClose
Description copied from interface:ListenableAsyncCloseableReturns aCompletablethat is notified once theListenableAsyncCloseablewas closed.- Specified by:
onClosein interfaceListenableAsyncCloseable- Returns:
- the
Completablethat is notified on close.
-
onClosing
Description copied from interface:ListenableAsyncCloseableReturns aCompletablethat 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 aconnection: closeheader).For backwards compatibility this method maybe functionally equivalent to
ListenableAsyncCloseable.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.- Specified by:
onClosingin interfaceListenableAsyncCloseable- Returns:
- a
Completablethat is notified when closing begins.
-