public interface CompositeCloseable extends AsyncCloseable, GracefulAutoCloseable
| Modifier and Type | Method and Description |
|---|---|
<T extends AsyncCloseable> |
append(T closeable)
Appends the passed
AsyncCloseable with this CompositeCloseable such that when this CompositeCloseable is closed, all of the previously registered AsyncCloseables are closed too. |
CompositeCloseable |
appendAll(AsyncCloseable... asyncCloseables)
Appends all the passed
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. |
CompositeCloseable |
appendAll(Iterable<? extends AsyncCloseable> asyncCloseables)
Appends all the passed
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. |
void |
close()
Closes all contained
AsyncCloseables and awaits termination of all of them. |
Completable |
closeAsync()
Closes all contained
AsyncCloseables. |
<T extends AsyncCloseable> |
merge(T closeable)
Merges the passed
AsyncCloseable with this CompositeCloseable such that when this CompositeCloseable is closed, all of the previously registered AsyncCloseables are closed too. |
CompositeCloseable |
mergeAll(AsyncCloseable... asyncCloseables)
Merges all the passed
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. |
CompositeCloseable |
mergeAll(Iterable<? extends AsyncCloseable> asyncCloseables)
Merges all the passed
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. |
<T extends AsyncCloseable> |
prepend(T closeable)
Prepends the passed
AsyncCloseable with this CompositeCloseable such that when this CompositeCloseable is closed, all of the previously registered AsyncCloseables are closed too. |
CompositeCloseable |
prependAll(AsyncCloseable... asyncCloseables)
Prepends all the passed
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. |
CompositeCloseable |
prependAll(Iterable<? extends AsyncCloseable> asyncCloseables)
Prepends all the passed
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. |
closeAsyncGracefully<T extends AsyncCloseable> T merge(T closeable)
AsyncCloseable with this CompositeCloseable such that when this CompositeCloseable is closed, all of the previously registered AsyncCloseables are closed too. This
method subscribes to the passed in AsyncCloseable and the current composite set at the same time.
If an order of closure is required, then use append(AsyncCloseable) or prepend(AsyncCloseable).T - the type of AsyncCloseable to be mergedcloseable - AsyncCloseable that is closed when this CompositeCloseable is closed.TCompositeCloseable mergeAll(AsyncCloseable... asyncCloseables)
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. This method subscribes to all
passed in AsyncCloseables and the current composite set at the same time. If an order of closure is
required, then use appendAll(AsyncCloseable...) or prependAll(AsyncCloseable...).asyncCloseables - All AsyncCloseables that are closed when this CompositeCloseable is
closed.this.CompositeCloseable mergeAll(Iterable<? extends AsyncCloseable> asyncCloseables)
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. This method subscribes to all
passed in AsyncCloseables and the current composite set at the same time. If an order of closure is
required, then use appendAll(AsyncCloseable...) or prependAll(AsyncCloseable...).asyncCloseables - All AsyncCloseables that are closed when this CompositeCloseable is
closed.this.<T extends AsyncCloseable> T append(T closeable)
AsyncCloseable with this CompositeCloseable such that when this CompositeCloseable is closed, all of the previously registered AsyncCloseables are closed too. This
method subscribes to the passed in AsyncCloseable and the current composite set in order.
If an order of closure is not required, then use merge(AsyncCloseable).T - the type of AsyncCloseable to be appendedcloseable - AsyncCloseable that is closed when this CompositeCloseable is closed.T.CompositeCloseable appendAll(AsyncCloseable... asyncCloseables)
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. This method subscribes to all
passed in AsyncCloseables and the current composite set in the order they are passed to this method. If
an order of closure is not required, then use mergeAll(AsyncCloseable...).asyncCloseables - All AsyncCloseables that are closed when this CompositeCloseable is
closed.this.CompositeCloseable appendAll(Iterable<? extends AsyncCloseable> asyncCloseables)
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. This method subscribes to all
passed in AsyncCloseables and the current composite set in the order they are passed to this method. If
an order of closure is not required, then use mergeAll(AsyncCloseable...).asyncCloseables - All AsyncCloseables that are closed when this CompositeCloseable is
closed.this.<T extends AsyncCloseable> T prepend(T closeable)
AsyncCloseable with this CompositeCloseable such that when this CompositeCloseable is closed, all of the previously registered AsyncCloseables are closed too. This
method subscribes to the passed in AsyncCloseable and the current composite set in reverse order.
If an order of closure is not required, then use merge(AsyncCloseable).T - the type of AsyncCloseable to be prependedcloseable - AsyncCloseable that is closed when this CompositeCloseable is closed.T.CompositeCloseable prependAll(AsyncCloseable... asyncCloseables)
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. This method subscribes to all
passed in AsyncCloseables and the current composite set in the reverse order they are passed to this
method. If an order of closure is not required, then use mergeAll(AsyncCloseable...).asyncCloseables - All AsyncCloseables that are closed when this CompositeCloseable is
closed.this.CompositeCloseable prependAll(Iterable<? extends AsyncCloseable> asyncCloseables)
AsyncCloseables with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseables are closed too. This method subscribes to all
passed in AsyncCloseables and the current composite set in the reverse order they are passed to this
method. If an order of closure is not required, then use mergeAll(AsyncCloseable...).asyncCloseables - All AsyncCloseables that are closed when this CompositeCloseable is
closed.this.Completable closeAsync()
AsyncCloseables. If any of the contained AsyncCloseables terminated with a
failure, the returned Completable terminates with a failure only after all the contained AsyncCloseables have terminated.closeAsync in interface AsyncCloseableCompletable that is notified once the close is complete.void close()
throws Exception
AsyncCloseables and awaits termination of all of them. If any of the contained
AsyncCloseables terminated with a failure, this method terminates with an Exception only after
all the contained AsyncCloseables have terminated.close in interface AutoCloseableException - If any of the contained AsyncCloseables terminate with a failure.