Interface Instrumentation
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface Instrumentation extends java.lang.AutoCloseableInstrumentation represents an ongoing instrumentation with a given context ofInvocationInstrumenterif any. To force cleanup after the invocation, use the instance returned byforceCleanup()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 voidclose()Closes the active instrumentation.voidclose(boolean cleanup)Closes the active instrumentation with cleanup flag.default InstrumentationforceCleanup()Return an instance which guarantees that cleanup will be forced to the instrumenter upon closing.static Instrumentationnoop()
-
-
-
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:
closein 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=trueeven 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
-
-