mebigfatguy / fb-contrib

a FindBugs/SpotBugs plugin for doing static code analysis for java code bases
http://fb-contrib.sf.net
GNU Lesser General Public License v2.1
153 stars 45 forks source link

Discourage submitting tasks to ForkJoinPool.commonPool #335

Open mattnelson opened 5 years ago

mattnelson commented 5 years ago

When performing concurrent processing outside of a parallel stream, I have lazily used the common fork join pool to avoid creating my own executor service. Many times I have used it for blocking I/O operations which then have the ability to saturate the pool and therefore block all other attempts for other threads to use parallel streams as they were designed.

What do you think about adding a rule to warn when calling execute/submit/invoke*/newTaskFor/etc... directly on the common pool?

https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.html#commonPool--

mebigfatguy commented 5 years ago

I'll have to do some reading... pretty esoteric i'm thinking... Not that you are wrong, just i am ignorant here.