Interface Scope

All Superinterfaces:
AutoCloseable

public interface Scope extends AutoCloseable
An AutoCloseable that represents a mounted context for a block of code. A failure to call close() will generally break tracing or cause memory leaks. It is recommended that you use this class with a try-with-resources block:

 try (Scope ignored = span.makeCurrent()) {
   ...
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    static Scope
    Returns a Scope that does nothing.
  • Method Details

    • noop

      static Scope noop()
      Returns a Scope that does nothing. Represents attaching a Context when it is already attached.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable