List of usage examples for org.springframework.scheduling.concurrent ThreadPoolTaskExecutor ThreadPoolTaskExecutor
ThreadPoolTaskExecutor
From source file:com.aol.advertising.qiao.util.CommonUtils.java
public static ThreadPoolTaskExecutor createFixedThreadPoolExecutor(int threadPoolSize) { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(threadPoolSize); executor.setMaxPoolSize(threadPoolSize); executor.setQueueCapacity(0);/*from ww w . ja v a2s .c om*/ executor.setRejectedExecutionHandler(new CallerRunsPolicy()); return executor; }
From source file:kymr.github.io.future.FutureSpringApplication.java
@Bean ThreadPoolTaskExecutor tp() {// w w w .j av a 2s. co m ThreadPoolTaskExecutor te = new ThreadPoolTaskExecutor(); te.setCorePoolSize(10); // default core thread pool te.setQueueCapacity(200); te.setMaxPoolSize(100); // after core pool is full -> after queue capacity (generally, unlimited) is full -> then, max pool size works. te.setThreadNamePrefix("mythread"); te.initialize(); //te.setAllowCoreThreadTimeOut(); //te.getKeepAliveSeconds() //te.setTaskDecorator(); // for task monitoring return te; }
From source file:org.schedoscope.metascope.config.TaskConfiguration.java
@Bean public TaskExecutor asyncTaskExecutor() { ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); threadPoolTaskExecutor.setCorePoolSize(10); threadPoolTaskExecutor.setMaxPoolSize(10); threadPoolTaskExecutor.setWaitForTasksToCompleteOnShutdown(true); return threadPoolTaskExecutor; }
From source file:net.brainage.nest.NestApplication.java
@Bean public AsyncTaskExecutor asyncTaskExecutor() { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setCorePoolSize(5);/* w w w.j a v a 2s. c o m*/ taskExecutor.setMaxPoolSize(200); taskExecutor.setQueueCapacity(100); taskExecutor.setThreadNamePrefix("async-task-executor-"); taskExecutor.initialize(); return taskExecutor; }
From source file:zipkin.autoconfigure.storage.mysql.ZipkinMySQLStorageAutoConfiguration.java
@Bean @ConditionalOnMissingBean(Executor.class) Executor executor() {//w w w . j a v a2s.co m ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setThreadNamePrefix("ZipkinMySQLStorage-"); executor.initialize(); return executor; }
From source file:burstcoin.jminer.core.CoreConfig.java
/** * Reader pool./* ww w .j a v a2 s . co m*/ * * @return the thread pool task executor */ @Bean(name = "readerPool") public ThreadPoolTaskExecutor readerPool() { ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor(); pool.setThreadPriority(Thread.NORM_PRIORITY); // false-> triggers interrupt exception at shutdown pool.setWaitForTasksToCompleteOnShutdown(true); return pool; }
From source file:com.gnizr.core.robot.rss.TestCrawlRssFeed.java
protected void setUp() throws Exception { super.setUp(); executor = new ThreadPoolTaskExecutor(); executor.initialize();/*from ww w . ja v a2s .com*/ userManager = new UserManager(getGnizrDao()); forUserManager = new ForUserManager(getGnizrDao()); folderManager = new FolderManager(getGnizrDao()); bookmarkManager = new BookmarkManager(getGnizrDao()); bookmarkManager.addBookmarkListener(new ForUserListener(userManager, forUserManager)); bookmarkManager.addBookmarkListener(new FolderTagListener(folderManager)); feedManager = new FeedSubscriptionManager(getGnizrDao()); crawlRssFeed = new CrawlRssFeed(); crawlRssFeed.setServiceEnabled(true); crawlRssFeed.setBookmarkManager(bookmarkManager); crawlRssFeed.setFeedSubscriptionManager(feedManager); crawlRssFeed.setThreadPoolTaskExecutor(executor); }
From source file:org.obiba.mica.config.AsyncConfiguration.java
@Override @Bean// w w w . j ava 2s . c o m public Executor getAsyncExecutor() { Integer poolSize = propertyResolver.getProperty("poolSize", Integer.class, DEFAULT_POOL_SIZE); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(poolSize); executor.setMaxPoolSize(poolSize); executor.setQueueCapacity( propertyResolver.getProperty("queueCapacity", Integer.class, DEFAULT_QUEUE_CAPACITY)); executor.setThreadNamePrefix("mica-executor-"); return new ExceptionHandlingAsyncTaskExecutor(executor); }
From source file:org.apache.nutch.storage.local.SpringConfiguration.java
@Override public Executor getAsyncExecutor() { // TODO move magic numbers to properties file ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(7);/*from w ww . j a v a2 s .c o m*/ executor.setMaxPoolSize(42); executor.setQueueCapacity(11); executor.setThreadNamePrefix("SpringExecutor-"); executor.initialize(); return executor; }
From source file:com.epam.ta.reportportal.core.configs.JobsConfiguration.java
@Bean(name = "saveLogsTaskExecutor") public TaskExecutor saveLogsTaskExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setCorePoolSize(20);//from w w w .j av a 2s. com executor.setMaxPoolSize(200); executor.setQueueCapacity(400); executor.setAllowCoreThreadTimeOut(true); executor.setThreadNamePrefix("logs-task-exec"); executor.setRejectedExecutionHandler(new java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy()); return executor; }