Package io.opencensus.common
Interface NonThrowingCloseable
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
Scope
- All Known Implementing Classes:
CurrentSpanUtils.ScopeInSpan,CurrentTagMapUtils.WithTagMap,NoopScope,NoopScope
Deprecated.
An
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()) {
...
}
- Since:
- 0.5
-
Method Summary
-
Method Details
-
close
void close()Deprecated.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
Scopeis a better match for operations involving the current context.