public final class Closeables extends Object
Modifier and Type | Method and Description |
---|---|
static void |
closeSilently(Closeable... resources)
Closes the provided resources ignoring any errors which occurred.
|
static void |
closeSilently(Iterable<? extends Closeable> resources)
Closes the provided resources ignoring any errors which occurred.
|
static Runnable |
closeSilentlyAsync(Closeable... resources)
Closes asynchronously the provided resources ignoring any errors which occurred.
|
public static void closeSilently(Closeable... resources)
resources
- The resources to be closed, which may be null
.public static void closeSilently(Iterable<? extends Closeable> resources)
resources
- The resources to be closed, which may be null
.public static Runnable closeSilentlyAsync(Closeable... resources)
Meant to be used with Promise.thenAlways(Runnable)
or Promise.thenFinally(Runnable)
:
Usage example with HTTP Framework:
Request request = new Request();
Promise<Response, NeverThrowsException> promise =
handler.handle(context, request)
.thenAlways(closeSilentlyAsync(request));
resources
- The resources to be closed, which may be null
.Copyright © 2010-2018, ForgeRock All Rights Reserved.