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 AsyncCloseable s are closed too. |
CompositeCloseable |
appendAll(AsyncCloseable... asyncCloseables)
Appends all the passed
AsyncCloseable s with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseable s are closed too. |
CompositeCloseable |
appendAll(java.lang.Iterable<? extends AsyncCloseable> asyncCloseables)
Appends all the passed
AsyncCloseable s with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseable s are closed too. |
void |
close()
Closes all contained
AsyncCloseable s and awaits termination of all of them. |
Completable |
closeAsync()
Closes all contained
AsyncCloseable s. |
<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 AsyncCloseable s are closed too. |
CompositeCloseable |
mergeAll(AsyncCloseable... asyncCloseables)
Merges all the passed
AsyncCloseable s with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseable s are closed too. |
CompositeCloseable |
mergeAll(java.lang.Iterable<? extends AsyncCloseable> asyncCloseables)
Merges all the passed
AsyncCloseable s with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseable s 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 AsyncCloseable s are closed too. |
CompositeCloseable |
prependAll(AsyncCloseable... asyncCloseables)
Prepends all the passed
AsyncCloseable s with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseable s are closed too. |
CompositeCloseable |
prependAll(java.lang.Iterable<? extends AsyncCloseable> asyncCloseables)
Prepends all the passed
AsyncCloseable s with this CompositeCloseable such that when this CompositeCloseable is closed, all of these AsyncCloseable s are closed too. |
closeAsyncGracefully
closeGracefully
<T extends AsyncCloseable> T merge(T closeable)
AsyncCloseable
with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of the previously registered AsyncCloseable
s 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.T
CompositeCloseable mergeAll(AsyncCloseable... asyncCloseables)
AsyncCloseable
s with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of these AsyncCloseable
s are closed too. This method subscribes to all
passed in AsyncCloseable
s 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 AsyncCloseable
s that are closed when this CompositeCloseable
is
closed.this
.CompositeCloseable mergeAll(java.lang.Iterable<? extends AsyncCloseable> asyncCloseables)
AsyncCloseable
s with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of these AsyncCloseable
s are closed too. This method subscribes to all
passed in AsyncCloseable
s 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 AsyncCloseable
s 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 AsyncCloseable
s 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)
AsyncCloseable
s with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of these AsyncCloseable
s are closed too. This method subscribes to all
passed in AsyncCloseable
s 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 AsyncCloseable
s that are closed when this CompositeCloseable
is
closed.this
.CompositeCloseable appendAll(java.lang.Iterable<? extends AsyncCloseable> asyncCloseables)
AsyncCloseable
s with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of these AsyncCloseable
s are closed too. This method subscribes to all
passed in AsyncCloseable
s 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 AsyncCloseable
s 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 AsyncCloseable
s 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)
AsyncCloseable
s with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of these AsyncCloseable
s are closed too. This method subscribes to all
passed in AsyncCloseable
s 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 AsyncCloseable
s that are closed when this CompositeCloseable
is
closed.this
.CompositeCloseable prependAll(java.lang.Iterable<? extends AsyncCloseable> asyncCloseables)
AsyncCloseable
s with this CompositeCloseable
such that when this CompositeCloseable
is closed, all of these AsyncCloseable
s are closed too. This method subscribes to all
passed in AsyncCloseable
s 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 AsyncCloseable
s that are closed when this CompositeCloseable
is
closed.this
.Completable closeAsync()
AsyncCloseable
s. If any of the contained AsyncCloseable
s terminated with a
failure, the returned Completable
terminates with a failure only after all the contained AsyncCloseable
s have terminated.closeAsync
in interface AsyncCloseable
Completable
that is notified once the close is complete.void close() throws java.lang.Exception
AsyncCloseable
s and awaits termination of all of them. If any of the contained
AsyncCloseable
s terminated with a failure, this method terminates with an Exception
only after
all the contained AsyncCloseable
s have terminated.close
in interface java.lang.AutoCloseable
java.lang.Exception
- If any of the contained AsyncCloseable
s terminate with a failure.