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

Make blockedThreadDetectionEnabled configurable via a system property #3567

Merged

Conversation

chunjef
Copy link
Contributor

@chunjef chunjef commented Apr 26, 2023

Resolves #3561.

Comment on lines 256 to 260
protected def blockedThreadDetectionEnabled: Boolean =
Option(System.getProperty("cats.effect.detectBlockedThreads")).map(_.toLowerCase()) match {
case Some(value) => value.equalsIgnoreCase("true")
case None => false // default to disabled
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we simplify this with java.lang.Boolean.getBoolean method.

https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html#getBoolean-java.lang.String-

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like using getBoolean would indeed be simpler. Updating the branch.

@@ -25,6 +25,7 @@ This can be done for example with the [EnvironmentPlugin for Webpack](https://we

| System Property (JVM) / ENV Variable (JS) | Value (default) | Description |
|---------------------------------------------------------------------------------------------------|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| `cats.effect.detectBlockedThreads` <br/> N/A | `Boolean` (`false`) | Whether or not we should detect blocked threads. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution!

@djspiewak djspiewak merged commit 72cc518 into typelevel:series/3.x Apr 26, 2023
41 checks passed
@chunjef chunjef deleted the blocked-thread-detection-sys-prop-3561 branch April 27, 2023 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make thread-blocking detector configurable via system property
3 participants