public static class BlockHound.Builder
extends java.lang.Object
| Modifier and Type | Method and Description | 
|---|---|
BlockHound.Builder | 
addDynamicThreadPredicate(java.util.function.Predicate<java.lang.Thread> predicate)
Appends the provided predicate to the current one. 
 | 
BlockHound.Builder | 
allowBlockingCallsInside(java.lang.String className,
                        java.lang.String methodName)
Allows blocking calls inside any method of a class with name identified by the provided className
 and which name matches the provided methodName. 
 | 
BlockHound.Builder | 
blockingMethodCallback(java.util.function.Consumer<BlockingMethod> consumer)
Overrides the callback that is being triggered when a blocking method is detected 
 | 
BlockHound.Builder | 
disallowBlockingCallsInside(java.lang.String className,
                           java.lang.String methodName)
Disallows blocking calls inside any method of a class with name identified by the provided className
 and which name matches the provided methodName. 
 | 
BlockHound.Builder | 
dynamicThreadPredicate(java.util.function.Function<java.util.function.Predicate<java.lang.Thread>,java.util.function.Predicate<java.lang.Thread>> function)
Replaces the current dynamic thread predicate with the result of applying the provided function. 
 | 
void | 
install()
Installs the agent and runs the instrumentation, but only if BlockHound wasn't installed yet (it is global). 
 | 
BlockHound.Builder | 
loadIntegrations(BlockHoundIntegration... integrations)
Loads integrations with  
ServiceLoader and adds provided integrations
 using {with(BlockHoundIntegration)}. | 
BlockHound.Builder | 
markAsBlocking(java.lang.Class clazz,
              java.lang.String methodName,
              java.lang.String signature)
Marks provided method of the provided class as "blocking". 
 | 
BlockHound.Builder | 
markAsBlocking(java.lang.String className,
              java.lang.String methodName,
              java.lang.String signature)
Marks provided method of the class identified by the provided name as "blocking". 
 | 
BlockHound.Builder | 
nonBlockingThreadPredicate(java.util.function.Function<java.util.function.Predicate<java.lang.Thread>,java.util.function.Predicate<java.lang.Thread>> function)
Replaces the current non-blocking thread predicate with the result of applying the provided function. 
 | 
BlockHound.Builder | 
with(BlockHoundIntegration integration)
Applies the provided  
BlockHoundIntegration to the current builder | 
BlockHound.Builder | 
with(java.lang.instrument.Instrumentation instrumentation)
Configure the  
Instrumentation to use. | 
public BlockHound.Builder markAsBlocking(java.lang.Class clazz, java.lang.String methodName, java.lang.String signature)
clazz - a class referencemethodName - a method namesignature - a method descriptor in JVM's formatpublic BlockHound.Builder markAsBlocking(java.lang.String className, java.lang.String methodName, java.lang.String signature)
className - class' name (e.g. "java.lang.Thread")methodName - a method namesignature - a method signature (in JVM's format)public BlockHound.Builder allowBlockingCallsInside(java.lang.String className, java.lang.String methodName)
 There are two special cases for methodName:
 
"<clinit>"
     className - class' name (e.g. "java.lang.Thread")methodName - a method namepublic BlockHound.Builder disallowBlockingCallsInside(java.lang.String className, java.lang.String methodName)
 There are two special cases for methodName:
 
"<clinit>"
     className - class' name (e.g. "java.lang.Thread")methodName - a method namepublic BlockHound.Builder blockingMethodCallback(java.util.function.Consumer<BlockingMethod> consumer)
consumer - a consumer of the detected blocking method call's description (BlockingMethod).public BlockHound.Builder nonBlockingThreadPredicate(java.util.function.Function<java.util.function.Predicate<java.lang.Thread>,java.util.function.Predicate<java.lang.Thread>> function)
Predicate.or(Predicate) and not override the previous one:
 
 nonBlockingThreadPredicate(current -> current.or(MyMarker.class::isInstance))
 function - a function to immediately apply on the current instance of the predicatepublic BlockHound.Builder dynamicThreadPredicate(java.util.function.Function<java.util.function.Predicate<java.lang.Thread>,java.util.function.Predicate<java.lang.Thread>> function)
Predicate.or(Predicate) and not override the previous one:
 
 dynamicThreadPredicate(current -> current.or(MyMarker.class::isInstance))
 function - a function to immediately apply on the current instance of the predicatepublic BlockHound.Builder addDynamicThreadPredicate(java.util.function.Predicate<java.lang.Thread> predicate)
predicate - a predicate to append to the current instance of the predicatepublic BlockHound.Builder loadIntegrations(BlockHoundIntegration... integrations)
ServiceLoader and adds provided integrations
 using {with(BlockHoundIntegration)}.
 If you don't want to load the integrations using service loader, only use
 with(BlockHoundIntegration) method.integrations - an array of integrations to automatically apply on the builder using
 with(BlockHoundIntegration)BlockHound.builder()public BlockHound.Builder with(BlockHoundIntegration integration)
BlockHoundIntegration to the current builderintegration - an integration to applypublic BlockHound.Builder with(java.lang.instrument.Instrumentation instrumentation)
Instrumentation to use. If not provided, ByteBuddyAgent.install() is used.instrumentation - The instrumentation instance to use.public void install()