Interface Instrumentation

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface Instrumentation
    extends java.lang.AutoCloseable

    Instrumentation represents an ongoing instrumentation with a given context of InvocationInstrumenter if any.

    To force cleanup after the invocation, use the instance returned by forceCleanup() instead, such as:

     try (Instrumentation ignored = instrumenter.newInstrumentation().forceCleanup()) {
         ...
     }
     
    Since:
    2.0
    • Method Detail

      • close

        void close​(boolean cleanup)
        Closes the active instrumentation with cleanup flag.
        Parameters:
        cleanup - Whether to enforce cleanup
      • close

        default void close()
        Closes the active instrumentation.
        Specified by:
        close in interface java.lang.AutoCloseable
      • forceCleanup

        @NonNull
        default Instrumentation forceCleanup()
        Return an instance which guarantees that cleanup will be forced to the instrumenter upon closing. The returned instance will always invoke close(boolean) with cleanup = true even if close(boolean) gets called with cleanup = false
        Returns:
        a new instance which forces cleanup upon leaving the protected block.
      • noop

        @NonNull
        static Instrumentation noop()
        Returns:
        an instance which does no instrumentation