Example usage for org.springframework.scheduling.concurrent ThreadPoolExecutorFactoryBean ThreadPoolExecutorFactoryBean

List of usage examples for org.springframework.scheduling.concurrent ThreadPoolExecutorFactoryBean ThreadPoolExecutorFactoryBean

Introduction

In this page you can find the example usage for org.springframework.scheduling.concurrent ThreadPoolExecutorFactoryBean ThreadPoolExecutorFactoryBean.

Prototype

ThreadPoolExecutorFactoryBean

Source Link

Usage

From source file:io.pivotal.strepsirrhini.chaoslemur.Application.java

@Bean(destroyMethod = "shutdown")
ThreadPoolExecutorFactoryBean executor() {
    ThreadPoolExecutorFactoryBean factoryBean = new ThreadPoolExecutorFactoryBean();
    factoryBean.setQueueCapacity(5);/*  w w  w.  ja v  a 2s .  co m*/
    factoryBean.setCorePoolSize(5);
    factoryBean.setMaxPoolSize(20);
    factoryBean.setThreadNamePrefix("destroyer-");

    return factoryBean;
}

From source file:com.sequenceiq.ambari.shell.configuration.ShellConfiguration.java

@Bean
ThreadPoolExecutorFactoryBean getThreadPoolExecutorFactoryBean() {
    return new ThreadPoolExecutorFactoryBean();
}

From source file:org.apereo.portal.utils.ConcurrentDirectoryScannerTest.java

@Before
public void setup() throws Exception {
    testDirectory = File.createTempFile("ConcurrentDirectoryScannerTest_", "_dir");
    testDirectory.delete();//from w  ww  .  j  av  a  2  s  .  c  om
    testDirectory.mkdirs();

    final InputStream dataZipStream = this.getClass()
            .getResourceAsStream("/org/apereo/portal/utils/DirScannerData.zip");
    ZipUtils.extract(dataZipStream, testDirectory);
    IOUtils.closeQuietly(dataZipStream);

    executorServiceFactory = new ThreadPoolExecutorFactoryBean();
    executorServiceFactory.setCorePoolSize(0);
    executorServiceFactory.setMaxPoolSize(1);
    executorServiceFactory.setQueueCapacity(500);
    executorServiceFactory.setKeepAliveSeconds(30);
    executorServiceFactory.setAllowCoreThreadTimeOut(true);
    executorServiceFactory.setDaemon(true);
    executorServiceFactory.afterPropertiesSet();

    this.directoryScanner = new ConcurrentDirectoryScanner(executorServiceFactory.getObject());
}

From source file:org.jasig.portal.utils.ConcurrentDirectoryScannerTest.java

@Before
public void setup() throws Exception {
    testDirectory = File.createTempFile("ConcurrentDirectoryScannerTest_", "_dir");
    testDirectory.delete();/*from w ww. j av a  2s . c o m*/
    testDirectory.mkdirs();

    final InputStream dataZipStream = this.getClass()
            .getResourceAsStream("/org/jasig/portal/utils/DirScannerData.zip");
    ZipUtils.extract(dataZipStream, testDirectory);
    IOUtils.closeQuietly(dataZipStream);

    executorServiceFactory = new ThreadPoolExecutorFactoryBean();
    executorServiceFactory.setCorePoolSize(0);
    executorServiceFactory.setMaxPoolSize(1);
    executorServiceFactory.setQueueCapacity(500);
    executorServiceFactory.setKeepAliveSeconds(30);
    executorServiceFactory.setAllowCoreThreadTimeOut(true);
    executorServiceFactory.setDaemon(true);
    executorServiceFactory.afterPropertiesSet();

    this.directoryScanner = new ConcurrentDirectoryScanner(executorServiceFactory.getObject());
}