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 ofListenableAsyncCloseable
to 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 T
delegate()
Get theDelegatingListenableAsyncCloseable
subtype ofListenableAsyncCloseable
that this class delegates to.onClose()
Returns aCompletable
that is notified once theListenableAsyncCloseable
was closed.Returns aCompletable
that is notified when closing begins.Methods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefully, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
-
Constructor Details
-
DelegatingListenableAsyncCloseable
New instance.- Parameters:
delegate
-DelegatingListenableAsyncCloseable
subtype ofListenableAsyncCloseable
to delegate all calls to.
-
-
Method Details
-
delegate
Get theDelegatingListenableAsyncCloseable
subtype ofListenableAsyncCloseable
that this class delegates to.- Overrides:
delegate
in classDelegatingAsyncCloseable<T extends ListenableAsyncCloseable>
- Returns:
- the
DelegatingListenableAsyncCloseable
subtype ofListenableAsyncCloseable
that this class delegates to.
-
onClose
Description copied from interface:ListenableAsyncCloseable
Returns aCompletable
that is notified once theListenableAsyncCloseable
was closed.- Specified by:
onClose
in interfaceListenableAsyncCloseable
- Returns:
- the
Completable
that is notified on close.
-
onClosing
Description copied from interface:ListenableAsyncCloseable
Returns aCompletable
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 aconnection: close
header).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:
onClosing
in interfaceListenableAsyncCloseable
- Returns:
- a
Completable
that is notified when closing begins.
-