On 08/11/2018 10:17, r...@apache.org wrote:
> Author: remm
> Date: Thu Nov  8 10:17:43 2018
> New Revision: 1846116
> 
> URL: http://svn.apache.org/viewvc?rev=1846116&view=rev
> Log:
> Add a scheduled executor service to the Service, which can be used to process 
> utility tasks including periodic ones.
> Add a simple wrapper to prevent random lifecycle and configuration operations.
> Add a bean for it.

<snip/>

> Modified: tomcat/trunk/java/org/apache/catalina/core/StandardService.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardService.java?rev=1846116&r1=1846115&r2=1846116&view=diff

<snip/>

> +    private synchronized void reconfigureUtilityExecutor(int threads) {
> +        if (utilityExecutor != null) {
> +            utilityExecutor.setMaximumPoolSize(threads);

I'm seeing a SpotBugs warning on the above line that calling
setMaximumPoolSize() is a NO-OP. From the Javadoc:

<quote>
In particular, because it acts as a fixed-sized pool using {@code
corePoolSize} threads and an unbounded queue, adjustments to {@code
maximumPoolSize} have no useful effect.
</quote>

Should this be calling setCorePoolSize() ?

Mark

> +        } else {
> +            ScheduledThreadPoolExecutor scheduledThreadPoolExecutor =
> +                    new ScheduledThreadPoolExecutor(1, new 
> UtilityThreadFactory(getName() + "-utility-"));
> +            scheduledThreadPoolExecutor.setMaximumPoolSize(threads);
> +            scheduledThreadPoolExecutor.setKeepAliveTime(10, 
> TimeUnit.SECONDS);
> +            scheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true);
> +            
> scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
> +            utilityExecutor = scheduledThreadPoolExecutor;
> +            utilityExecutorWrapper = new 
> org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor(utilityExecutor);
> +        }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to