Package io.servicetalk.concurrent.api
Interface CompositeCloseable
- All Superinterfaces:
AsyncCloseable,AutoCloseable,GracefulAutoCloseable
-
Method Summary
Modifier and TypeMethodDescription<T extends AsyncCloseable>
Tappend(T closeable) Appends the passedAsyncCloseablewith thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of the previously registeredAsyncCloseables are closed too.appendAll(AsyncCloseable... asyncCloseables) Appends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too.appendAll(Iterable<? extends AsyncCloseable> asyncCloseables) Appends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too.voidclose()Closes all containedAsyncCloseables and awaits termination of all of them.Closes all containedAsyncCloseables.<T extends AsyncCloseable>
Tmerge(T closeable) Merges the passedAsyncCloseablewith thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of the previously registeredAsyncCloseables are closed too.mergeAll(AsyncCloseable... asyncCloseables) Merges all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too.mergeAll(Iterable<? extends AsyncCloseable> asyncCloseables) Merges all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too.<T extends AsyncCloseable>
Tprepend(T closeable) Prepends the passedAsyncCloseablewith thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of the previously registeredAsyncCloseables are closed too.prependAll(AsyncCloseable... asyncCloseables) Prepends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too.prependAll(Iterable<? extends AsyncCloseable> asyncCloseables) Prepends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.GracefulAutoCloseable
closeGracefully
-
Method Details
-
merge
Merges the passedAsyncCloseablewith thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of the previously registeredAsyncCloseables are closed too. This method subscribes to the passed inAsyncCloseableand the current composite set at the same time. If an order of closure is required, then useappend(AsyncCloseable)orprepend(AsyncCloseable).- Type Parameters:
T- the type ofAsyncCloseableto be merged- Parameters:
closeable-AsyncCloseablethat is closed when thisCompositeCloseableis closed.- Returns:
T
-
mergeAll
Merges all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too. This method subscribes to all passed inAsyncCloseables and the current composite set at the same time. If an order of closure is required, then useappendAll(AsyncCloseable...)orprependAll(AsyncCloseable...).- Parameters:
asyncCloseables- AllAsyncCloseables that are closed when thisCompositeCloseableis closed.- Returns:
this.
-
mergeAll
Merges all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too. This method subscribes to all passed inAsyncCloseables and the current composite set at the same time. If an order of closure is required, then useappendAll(AsyncCloseable...)orprependAll(AsyncCloseable...).- Parameters:
asyncCloseables- AllAsyncCloseables that are closed when thisCompositeCloseableis closed.- Returns:
this.
-
append
Appends the passedAsyncCloseablewith thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of the previously registeredAsyncCloseables are closed too. This method subscribes to the passed inAsyncCloseableand the current composite set in order. If an order of closure is not required, then usemerge(AsyncCloseable).- Type Parameters:
T- the type ofAsyncCloseableto be appended- Parameters:
closeable-AsyncCloseablethat is closed when thisCompositeCloseableis closed.- Returns:
T.
-
appendAll
Appends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too. This method subscribes to all passed inAsyncCloseables and the current composite set in the order they are passed to this method. If an order of closure is not required, then usemergeAll(AsyncCloseable...).- Parameters:
asyncCloseables- AllAsyncCloseables that are closed when thisCompositeCloseableis closed.- Returns:
this.
-
appendAll
Appends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too. This method subscribes to all passed inAsyncCloseables and the current composite set in the order they are passed to this method. If an order of closure is not required, then usemergeAll(AsyncCloseable...).- Parameters:
asyncCloseables- AllAsyncCloseables that are closed when thisCompositeCloseableis closed.- Returns:
this.
-
prepend
Prepends the passedAsyncCloseablewith thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of the previously registeredAsyncCloseables are closed too. This method subscribes to the passed inAsyncCloseableand the current composite set in reverse order. If an order of closure is not required, then usemerge(AsyncCloseable).- Type Parameters:
T- the type ofAsyncCloseableto be prepended- Parameters:
closeable-AsyncCloseablethat is closed when thisCompositeCloseableis closed.- Returns:
T.
-
prependAll
Prepends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too. This method subscribes to all passed inAsyncCloseables and the current composite set in the reverse order they are passed to this method. If an order of closure is not required, then usemergeAll(AsyncCloseable...).- Parameters:
asyncCloseables- AllAsyncCloseables that are closed when thisCompositeCloseableis closed.- Returns:
this.
-
prependAll
Prepends all the passedAsyncCloseables with thisCompositeCloseablesuch that when thisCompositeCloseableis closed, all of theseAsyncCloseables are closed too. This method subscribes to all passed inAsyncCloseables and the current composite set in the reverse order they are passed to this method. If an order of closure is not required, then usemergeAll(AsyncCloseable...).- Parameters:
asyncCloseables- AllAsyncCloseables that are closed when thisCompositeCloseableis closed.- Returns:
this.
-
closeAsync
Completable closeAsync()Closes all containedAsyncCloseables. If any of the containedAsyncCloseables terminated with a failure, the returnedCompletableterminates with a failure only after all the containedAsyncCloseables have terminated.- Specified by:
closeAsyncin interfaceAsyncCloseable- Returns:
- the
Completablethat is notified once the close is complete.
-
close
Closes all containedAsyncCloseables and awaits termination of all of them. If any of the containedAsyncCloseables terminated with a failure, this method terminates with anExceptiononly after all the containedAsyncCloseables have terminated.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- If any of the containedAsyncCloseables terminate with a failure.
-