Skip to content

Commit

Permalink
Add an explanation for ThreadPriorityCheck
Browse files Browse the repository at this point in the history
Fixes #1503

PiperOrigin-RevId: 350677546
  • Loading branch information
cushon authored and Error Prone Team committed Jan 8, 2021
1 parent f65797b commit a5f3056
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
*/
@BugPattern(
name = "ThreadPriorityCheck",
summary =
"Relying on the thread scheduler is discouraged; "
+ "see Effective Java 3rd Edition Item 84.",
summary = "Relying on the thread scheduler is discouraged.",
severity = WARNING)
public class ThreadPriorityCheck extends BugChecker implements MethodInvocationTreeMatcher {

Expand Down
8 changes: 8 additions & 0 deletions docs/bugpattern/ThreadPriorityCheck.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Don't rely on the thread scheduler for correctness or performance. Instead,
ensure that the average number of runnable threads is not significantly greater
than the number of processors, i.e. by using the executor framework and an
appropriately sized thread pool.

For more information, see [Effective Java 3rd Edition §84][ej3e-84].

[ej3e-84]: https://books.google.com/books?id=BIpDDwAAQBAJ

0 comments on commit a5f3056

Please sign in to comment.