Package io.servicetalk.concurrent.api
Class DelegatingAsyncCloseable<T extends AsyncCloseable>
java.lang.Object
io.servicetalk.concurrent.api.DelegatingAsyncCloseable<T>
- Type Parameters:
T- The type ofAsyncCloseableto delegate to.
- All Implemented Interfaces:
AsyncCloseable
- Direct Known Subclasses:
DelegatingListenableAsyncCloseable
public class DelegatingAsyncCloseable<T extends AsyncCloseable>
extends Object
implements AsyncCloseable
AsyncCloseable that delegates all calls to another AsyncCloseable.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUsed to close/shutdown a resource.Used to close/shutdown a resource, similar toAsyncCloseable.closeAsync(), but attempts to cleanup state before abruptly closing.protected Tdelegate()Get theDelegatingAsyncCloseablesubtype ofAsyncCloseablethat this class delegates to.toString()
-
Constructor Details
-
DelegatingAsyncCloseable
New instance.- Parameters:
delegate-DelegatingAsyncCloseablesubtype ofAsyncCloseableto delegate all calls to.
-
-
Method Details
-
delegate
Get theDelegatingAsyncCloseablesubtype ofAsyncCloseablethat this class delegates to.- Returns:
- the
DelegatingAsyncCloseablesubtype ofAsyncCloseablethat this class delegates to.
-
closeAsync
Description copied from interface:AsyncCloseableUsed to close/shutdown a resource.- Specified by:
closeAsyncin interfaceAsyncCloseable- Returns:
- A
Completablethat is notified once the close is complete.
-
closeAsyncGracefully
Description copied from interface:AsyncCloseableUsed to close/shutdown a resource, similar toAsyncCloseable.closeAsync(), but attempts to cleanup state before abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in flight work. This method is implemented on a "best effort" basis and may be equivalent toAsyncCloseable.closeAsync().Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a timeout and force a call to
AsyncCloseable.closeAsync().- Specified by:
closeAsyncGracefullyin interfaceAsyncCloseable- Returns:
- A
Completablethat is notified once the close is complete.
-
toString
-