Interface NonThrowingCloseable

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Subinterfaces:
    Scope
    All Known Implementing Classes:
    CurrentSpanUtils.ScopeInSpan, CurrentTagMapUtils.WithTagMap, NoopScope, NoopScope

    @Deprecated
    public interface NonThrowingCloseable
    extends java.io.Closeable
    Deprecated.
    Scope is a better match for operations involving the current context.
    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 Detail

      • close

        void close()
        Deprecated.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable