Scope is a better match for operations involving the current context.@Deprecated public interface NonThrowingCloseable extends Closeable
Closeable which cannot throw a checked exception.
This is useful because such a reversion otherwise requires the caller to catch the (impossible) Exception in the try-with-resources.
Example of usage:
try (NonThrowingAutoCloseable ctx = tryEnter()) {
...
}
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Deprecated.
|
void close()
close in interface AutoCloseableclose in interface Closeable