Example usage for java.util.concurrent ScheduledThreadPoolExecutor setCorePoolSize

List of usage examples for java.util.concurrent ScheduledThreadPoolExecutor setCorePoolSize

Introduction

In this page you can find the example usage for java.util.concurrent ScheduledThreadPoolExecutor setCorePoolSize.

Prototype

public void setCorePoolSize(int corePoolSize) 

Source Link

Document

Sets the core number of threads.

Usage

From source file:org.mule.config.pool.DefaultThreadPoolFactory.java

protected ScheduledThreadPoolExecutor internalCreateScheduledPool(ThreadingProfile tp) {
    ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(
            Math.min(tp.getMaxThreadsIdle(), tp.getMaxThreadsActive()));
    scheduledThreadPoolExecutor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
    scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(true);
    scheduledThreadPoolExecutor.setKeepAliveTime(tp.getThreadTTL(), TimeUnit.MILLISECONDS);
    scheduledThreadPoolExecutor.setCorePoolSize(tp.getMaxThreadsIdle());
    scheduledThreadPoolExecutor.setMaximumPoolSize(tp.getMaxThreadsActive());
    return scheduledThreadPoolExecutor;
}