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 Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Closes the active instrumentation.void
close(boolean cleanup)
Closes the active instrumentation with cleanup flag.default Instrumentation
forceCleanup()
Return an instance which guarantees that cleanup will be forced to the instrumenter upon closing.static Instrumentation
noop()
-
-
-
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 interfacejava.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 invokeclose(boolean)
withcleanup = true
even ifclose(boolean)
gets called withcleanup = 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
-
-