Search in sources :

Example 1 with ExecutorServiceManager

use of io.dropwizard.lifecycle.ExecutorServiceManager in project dropwizard by dropwizard.

the class ScheduledExecutorServiceBuilder method build.

public ScheduledExecutorService build() {
    final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(poolSize, threadFactory, handler);
    environment.manage(new ExecutorServiceManager(executor, shutdownTime, nameFormat));
    return executor;
}
Also used : ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ExecutorServiceManager(io.dropwizard.lifecycle.ExecutorServiceManager)

Example 2 with ExecutorServiceManager

use of io.dropwizard.lifecycle.ExecutorServiceManager in project dropwizard by dropwizard.

the class ExecutorServiceBuilder method build.

public ExecutorService build() {
    if (corePoolSize != maximumPoolSize && maximumPoolSize > 1 && !isBoundedQueue()) {
        log.warn("Parameter 'maximumPoolSize' is conflicting with unbounded work queues");
    }
    final ThreadPoolExecutor executor = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime.getQuantity(), keepAliveTime.getUnit(), workQueue, threadFactory, handler);
    environment.manage(new ExecutorServiceManager(executor, shutdownTime, nameFormat));
    return executor;
}
Also used : ExecutorServiceManager(io.dropwizard.lifecycle.ExecutorServiceManager) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Aggregations

ExecutorServiceManager (io.dropwizard.lifecycle.ExecutorServiceManager)2 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1