Resource#close() might throw.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static AutoCloseable | Returns: AnAutoCloseable that will dispose of the given object when closed.The object to dispose of. obj)Return an |
| public static void | dispose(Object
The object to dispose of. obj, InternalLogger The logger to use for recording any exceptions thrown by the disposal. logger)Attempt to dispose of whatever the given object is. |
| public static void | tryPropagatingDispose(Object
The object to dispose of. obj)Attempt to dispose of whatever the given object is, but only if it is disposable. |
| public static void | trySilentDispose(Object
The object to dispose of. obj, InternalLogger The logger to use for recording any exceptions thrown by the disposal. logger)Attempt to dispose of whatever the given object is, but only if it is disposable. |
| SilentDispose | back to summary |
|---|---|
| private SilentDispose() | |
| autoClosing | back to summary |
|---|---|
| public static AutoCloseable autoClosing(Object obj) Return an The benefit of this approach is that exceptions are correctly handled if both the try-body, and the resource disposal, throws. This is not a silent operation, in that exceptions from resource disposal will propagate. However, the try-with-resources clause will guarantee that resource disposal exceptions won't shadow any exceptions from the try-body
| |
| dispose | back to summary |
|---|---|
| public static void dispose(Object obj, InternalLogger logger) Attempt to dispose of whatever the given object is.
This method works similarly to
If the object is
Any exceptions caused by this will be logged using the given logger.
The exception will be logged at log-level
| |
| tryPropagatingDispose | back to summary |
|---|---|
| public static void tryPropagatingDispose(Object obj) Attempt to dispose of whatever the given object is, but only if it is disposable.
This method works similarly to
Any exceptions caused the disposal will be allowed to propagate from this method, which is in contrast to how
| |
| trySilentDispose | back to summary |
|---|---|
| public static void trySilentDispose(Object obj, InternalLogger logger) Attempt to dispose of whatever the given object is, but only if it is disposable.
This method works similarly to
Any exceptions caused by the disposal of the object will be logged using the given logger.
The exception will be logged at log-level
| |