rspec/rules/S2122/java/rule.adoc

26 lines
757 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++java.util.concurrent.ScheduledThreadPoolExecutor++``'s pool is sized with ``++corePoolSize++``, so setting ``++corePoolSize++`` to zero means the executor will have no threads and run nothing.
This rule detects instances where ``++corePoolSize++`` is set to zero, via either its setter or the object constructor.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
public void do(){
ScheduledThreadPoolExecutor stpe1 = new ScheduledThreadPoolExecutor(0); // Noncompliant
ScheduledThreadPoolExecutor stpe2 = new ScheduledThreadPoolExecutor(POOL_SIZE);
stpe2.setCorePoolSize(0); // Noncompliant
----
ifdef::env-github,rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]