Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document <clinit> special name in (dis)allowBlockingCallsInside #185

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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