public class BlockHound
extends java.lang.Object
install(BlockHoundIntegration...)
or builder()
.
On installation, it will run the instrumentation and add the check to the blocking methods.
Note that the installation can (and should) only be done once, subsequent install calls will be ignored.
Hence, the best place to put the install call is before all tests
or in the beginning of your "public static void main" method.
If you have it automatically installed (e.g. via a testing framework integration), you can apply the customizations
by using the SPI mechanism (see BlockHoundIntegration
).Modifier and Type | Class and Description |
---|---|
static class |
BlockHound.Builder |
Modifier and Type | Method and Description |
---|---|
static BlockHound.Builder |
builder()
Creates a completely new
BlockHound.Builder that *does not* have any integration applied. |
static void |
install(BlockHoundIntegration... integrations)
Loads integrations with
ServiceLoader , adds provided integrations,
and installs the BlockHound instrumentation. |
static void |
premain(java.lang.String agentArgs,
java.lang.instrument.Instrumentation inst)
Entrypoint for installation via the
-javaagent= command-line option. |
public static BlockHound.Builder builder()
BlockHound.Builder
that *does not* have any integration applied.
Use it only if you want to ignore the built-in SPI mechanism (see install(BlockHoundIntegration...)
).BlockHound.Builder
install(BlockHoundIntegration...)
public static void install(BlockHoundIntegration... integrations)
ServiceLoader
, adds provided integrations,
and installs the BlockHound instrumentation.
If you don't want to load the integrations, use builder()
method.integrations
- an array of integrations to automatically apply on the intermediate builderbuilder()
public static void premain(java.lang.String agentArgs, java.lang.instrument.Instrumentation inst)
-javaagent=
command-line option.agentArgs
- Options for the agent.inst
- Instrumentation API.java.lang.instrument