use of org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean in project cloudbreak by hortonworks.
the class AppConfig method getThreadPoolExecutorFactoryBean.
@Bean
public ThreadPoolExecutorFactoryBean getThreadPoolExecutorFactoryBean() {
ThreadPoolExecutorFactoryBean executorFactoryBean = new ThreadPoolExecutorFactoryBean();
executorFactoryBean.setCorePoolSize(corePoolSize);
executorFactoryBean.setMaxPoolSize(maxPoolSize);
executorFactoryBean.setQueueCapacity(queueCapacity);
return executorFactoryBean;
}
use of org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean in project cas by apereo.
the class Beans method newThreadPoolExecutorFactoryBean.
/**
* New thread pool executor factory bean.
*
* @param keepAlive the keep alive
* @param maxSize the max size
* @return the thread pool executor factory bean
*/
public static ThreadPoolExecutorFactoryBean newThreadPoolExecutorFactoryBean(final long keepAlive, final long maxSize) {
final ThreadPoolExecutorFactoryBean bean = new ThreadPoolExecutorFactoryBean();
bean.setMaxPoolSize((int) maxSize);
bean.setKeepAliveSeconds((int) keepAlive);
return bean;
}
use of org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean in project cas by apereo.
the class Beans method newThreadPoolExecutorFactoryBean.
/**
* New thread pool executor factory bean.
*
* @param config the config
* @return the thread pool executor factory bean
*/
public static FactoryBean<ExecutorService> newThreadPoolExecutorFactoryBean(final ConnectionPoolingProperties config) {
val bean = new ThreadPoolExecutorFactoryBean();
bean.setMaxPoolSize(config.getMaxSize());
bean.setCorePoolSize(config.getMinSize());
bean.afterPropertiesSet();
return bean;
}
use of org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean in project uPortal by Jasig.
the class ConcurrentDirectoryScannerTest method setup.
@Before
public void setup() throws Exception {
testDirectory = File.createTempFile("ConcurrentDirectoryScannerTest_", "_dir");
testDirectory.delete();
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());
}
use of org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean in project uPortal by Jasig.
the class JaxbPortalDataHandlerServiceTest method setup.
@Before
public void setup() throws Exception {
xmlUtilities = new XmlUtilitiesImpl() {
@Override
public Templates getTemplates(Resource stylesheet) throws TransformerConfigurationException, IOException {
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
return transformerFactory.newTemplates(new StreamSource(stylesheet.getInputStream()));
}
};
dataImportExportService.setXmlUtilities(xmlUtilities);
final ThreadPoolExecutorFactoryBean threadPoolExecutorFactoryBean = new ThreadPoolExecutorFactoryBean();
threadPoolExecutorFactoryBean.setCorePoolSize(0);
threadPoolExecutorFactoryBean.setMaxPoolSize(20);
threadPoolExecutorFactoryBean.setQueueCapacity(20);
threadPoolExecutorFactoryBean.setThreadGroupName("uPortal-ImportExportThreadGroup");
threadPoolExecutorFactoryBean.setThreadNamePrefix("uPortal-ImportExport-");
threadPoolExecutorFactoryBean.setThreadPriority(5);
threadPoolExecutorFactoryBean.setKeepAliveSeconds(30);
threadPoolExecutorFactoryBean.setDaemon(true);
threadPoolExecutorFactoryBean.setAllowCoreThreadTimeOut(true);
threadPoolExecutorFactoryBean.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
threadPoolExecutorFactoryBean.afterPropertiesSet();
threadPoolExecutor = threadPoolExecutorFactoryBean.getObject();
this.dataImportExportService.setImportExportThreadPool(threadPoolExecutor);
dataImportExportService.setDataFileIncludes(ImmutableSet.of("**/*.xml", "**/*.entity-type", "**/*.template-user", "**/*.user", "**/*.group", "**/*.group_membership", "**/*.membership", "**/*.portlet-type", "**/*.channel-type", "**/*.portlet", "**/*.channel", "**/*.permission", "**/*.permission_set", "**/*.permission_owner", "**/*.profile", "**/*.fragment-layout", "**/*.layout", "**/*.fragment-definition"));
dataImportExportService.setDataTypeImportOrder(getPortalDataTypes());
}
Aggregations