Package org.forgerock.util
Class Closeables
java.lang.Object
org.forgerock.util.Closeables
Common utility methods for Closeables.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseSilently(Closeable... resources) Closes the provided resources ignoring any errors which occurred.static voidcloseSilently(AutoCloseable... resources) Closes the provided resources ignoring any errors which occurred.static voidcloseSilently(Iterable<? extends AutoCloseable> resources) Closes the provided resources ignoring any errors which occurred.static RunnablecloseSilentlyAsync(Closeable... resources) Closes asynchronously the provided resources ignoring any errors which occurred.static RunnablecloseSilentlyAsync(AutoCloseable... resources) Closes asynchronously the provided resources ignoring any errors which occurred.
-
Method Details
-
closeSilently
Closes the provided resources ignoring any errors which occurred.- Parameters:
resources- The resources to be closed, which may benull.
-
closeSilently
Closes the provided resources ignoring any errors which occurred.- Parameters:
resources- The resources to be closed, which may benull.
-
closeSilently
Closes the provided resources ignoring any errors which occurred.- Parameters:
resources- The resources to be closed, which may benull.
-
closeSilentlyAsync
Closes asynchronously the provided resources ignoring any errors which occurred.Meant to be used with
Promise.thenAlways(Runnable)orPromise.thenFinally(Runnable):Usage example with HTTP Framework:
Request request = new Request(); Promise<Response, NeverThrowsException> promise = handler.handle(context, request) .thenAlways(closeSilentlyAsync(request));- Parameters:
resources- The resources to be closed, which may benull.- Returns:
- Runnable to be used as callback
-
closeSilentlyAsync
Closes asynchronously the provided resources ignoring any errors which occurred.Meant to be used with
Promise.thenAlways(Runnable)orPromise.thenFinally(Runnable):Usage example with HTTP Framework:
Request request = new Request(); Promise<Response, NeverThrowsException> promise = handler.handle(context, request) .thenAlways(closeSilentlyAsync(request));- Parameters:
resources- The resources to be closed, which may benull.- Returns:
- Runnable to be used as callback
-