public interface Instrumentation extends 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()) { ... }
Modifier and Type | Method and 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() |
void close(boolean cleanup)
cleanup
- Whether to enforce cleanupdefault void close()
close
in interface AutoCloseable
@NonNull default Instrumentation forceCleanup()
close(boolean)
with cleanup = true
even if close(boolean)
gets called with cleanup = false
@NonNull static Instrumentation noop()