Skip to content

Commit

Permalink
Document <clinit> special name in (dis)allowBlockingCallsInside (#185)
Browse files Browse the repository at this point in the history
This commit also mentions that constructors ("<init>") aren't
currently supported (see #174).

Fixes #178.
  • Loading branch information
simonbasle authored Mar 29, 2021
1 parent 7dd8d30 commit 6af0675
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions agent/src/main/java/reactor/blockhound/BlockHound.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,22 @@ public Builder markAsBlocking(String className, String methodName, String signat
/**
* Allows blocking calls inside any method of a class with name identified by the provided className
* and which name matches the provided methodName.
* <p>
* There are two special cases for {@code methodName}:
* <ul>
* <li>
* static initializers are currently supported by their JVM reserved name of {@code "<clinit>"}
* </li>
* <li>
* constructors are currently not supported (ByteBuddy cannot weave the necessary instrumentation around a constructor that throws an exception, see gh174)
* </li>
* </ul>
*
* @param className class' name (e.g. "java.lang.Thread")
* @param methodName a method name
* @return this
*/
// see https://github.com/reactor/BlockHound/issues/174
public Builder allowBlockingCallsInside(String className, String methodName) {
allowances.computeIfAbsent(className, __ -> new HashMap<>()).put(methodName, true);
return this;
Expand All @@ -303,11 +314,22 @@ public Builder allowBlockingCallsInside(String className, 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.
* <p>
* There are two special cases for {@code methodName}:
* <ul>
* <li>
* static initializers are currently supported by their JVM reserved name of {@code "<clinit>"}
* </li>
* <li>
* constructors are currently not supported (ByteBuddy cannot weave the necessary instrumentation around a constructor that throws an exception, see gh174)
* </li>
* </ul>
*
* @param className class' name (e.g. "java.lang.Thread")
* @param methodName a method name
* @return this
*/
// see https://github.com/reactor/BlockHound/issues/174
public Builder disallowBlockingCallsInside(String className, String methodName) {
allowances.computeIfAbsent(className, __ -> new HashMap<>()).put(methodName, false);
return this;
Expand Down

0 comments on commit 6af0675

Please sign in to comment.