當前位置: 首頁>>代碼示例>>Java>>正文


Java ThreadPoolTaskExecutor.setMaxPoolSize方法代碼示例

本文整理匯總了Java中org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.setMaxPoolSize方法的典型用法代碼示例。如果您正苦於以下問題:Java ThreadPoolTaskExecutor.setMaxPoolSize方法的具體用法?Java ThreadPoolTaskExecutor.setMaxPoolSize怎麽用?Java ThreadPoolTaskExecutor.setMaxPoolSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor的用法示例。


在下文中一共展示了ThreadPoolTaskExecutor.setMaxPoolSize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDefaultTaskExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
private TaskExecutor createDefaultTaskExecutor() {
	// create thread-pool for starting contexts
	ThreadGroup threadGroup =
			new ThreadGroup("eclipse-gemini-blueprint-extender[" + ObjectUtils.getIdentityHexString(this) + "]-threads");
	threadGroup.setDaemon(false);

	ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
	taskExecutor.setMaxPoolSize(Runtime.getRuntime().availableProcessors());
	taskExecutor.setThreadGroup(threadGroup);
	taskExecutor.setThreadNamePrefix("EclipseGeminiBlueprintExtenderThread-");
	taskExecutor.initialize();

	isTaskExecutorManagedInternally = true;

	return taskExecutor;
}
 
開發者ID:eclipse,項目名稱:gemini.blueprint,代碼行數:17,代碼來源:ExtenderConfiguration.java

示例2: myTaskAsyncPool

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean
public Executor myTaskAsyncPool() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(config.getCorePoolSize());
    executor.setMaxPoolSize(config.getMaxPoolSize());
    executor.setQueueCapacity(config.getQueueCapacity());
    executor.setKeepAliveSeconds(config.getKeepAliveSeconds());
    executor.setThreadNamePrefix("MyExecutor-");

    // rejection-policy:當pool已經達到max size的時候,如何處理新任務
    // CALLER_RUNS:不在新線程中執行任務,而是由調用者所在的線程來執行
    executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
    executor.initialize();
    return executor;
}
 
開發者ID:jeikerxiao,項目名稱:SpringBootStudy,代碼行數:16,代碼來源:TaskExecutePool.java

示例3: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
    executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
    executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
    executor.setThreadNamePrefix("gateway-Executor-");
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}
 
開發者ID:deepu105,項目名稱:spring-io,代碼行數:12,代碼來源:AsyncConfiguration.java

示例4: getProtocolleringAyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean
@Qualifier("protocolleringjob")
public Executor getProtocolleringAyncExecutor() {
    ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(1);
    threadPoolTaskExecutor.setMaxPoolSize(1);
    threadPoolTaskExecutor.setQueueCapacity(0);
    threadPoolTaskExecutor.setKeepAliveSeconds(0);
    threadPoolTaskExecutor.initialize();
    return threadPoolTaskExecutor;
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:12,代碼來源:JobAsyncConfiguration.java

示例5: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Override
public Executor getAsyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(5);
    executor.setMaxPoolSize(5);
    executor.setQueueCapacity(500);
    executor.setThreadNamePrefix("Chameleon-");
    executor.initialize();

    return executor;
}
 
開發者ID:Azure,項目名稱:CityPower-Build-Sample,代碼行數:12,代碼來源:AsyncConfig.java

示例6: asyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean
public Executor asyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(2);
    executor.setMaxPoolSize(2);
    executor.setQueueCapacity(500);
    executor.setThreadNamePrefix("MailSender-");
    executor.initialize();

    return executor;
}
 
開發者ID:BjoernKW,項目名稱:MailTrigger,代碼行數:12,代碼來源:MailTriggerApplication.java

示例7: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(asyncProperties.getCorePoolSize());
    executor.setMaxPoolSize(asyncProperties.getMaxPoolSize());
    executor.setQueueCapacity(asyncProperties.getQueueCapacity());
    executor.setThreadNamePrefix(asyncProperties.getNamePrefix());
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}
 
開發者ID:sdcuike,項目名稱:spring-boot-oauth2-demo,代碼行數:12,代碼來源:AsyncConfig.java

示例8: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean
@Override
public Executor getAsyncExecutor() {
  final ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
  taskExecutor.setCorePoolSize(5);
  taskExecutor.setMaxPoolSize(100);
  taskExecutor.setThreadNamePrefix("Thread-");
  return taskExecutor;
}
 
開發者ID:stefanstaniAIM,項目名稱:IPPR2016,代碼行數:10,代碼來源:SpringAsyncConfig.java

示例9: kafkaMsgExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean
public TaskExecutor kafkaMsgExecutor() {
  ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
  int corePoolSize = StringUtils.isBlank(environment.getProperty(EXECUTOR_SET_CORE_POOL_SIZE)) ? 5 : Integer.parseInt(environment.getProperty(EXECUTOR_SET_CORE_POOL_SIZE));
  int maxPoolSize = StringUtils.isBlank(environment.getProperty(EXECUTOR_SET_MAX_POOL_SIZE)) ? 10 : Integer.parseInt(environment.getProperty(EXECUTOR_SET_MAX_POOL_SIZE));
  int queueCapacity = StringUtils.isBlank(environment.getProperty(EXECUTOR_SET_QUEUE_CAPACITY)) ? 25 : Integer.parseInt(environment.getProperty(EXECUTOR_SET_QUEUE_CAPACITY));
  executor.setCorePoolSize(corePoolSize);
  executor.setMaxPoolSize(maxPoolSize);
  executor.setQueueCapacity(queueCapacity);
  return executor;
}
 
開發者ID:chuangxian,項目名稱:lib-edge,代碼行數:12,代碼來源:TransferDefaultConfiguration.java

示例10: asyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean(name = "register")
public Executor asyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(5);
    executor.setMaxPoolSize(5);
    executor.setQueueCapacity(500);
    executor.setThreadNamePrefix("RegisterInit-");
    executor.initialize();
    return executor;
}
 
開發者ID:cattientk,項目名稱:daros-dynamic,代碼行數:11,代碼來源:DynamicRegisterGroovyConf.java

示例11: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
    executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
    executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
    executor.setThreadNamePrefix("entity-Executor-");
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}
 
開發者ID:xm-online,項目名稱:xm-ms-entity,代碼行數:12,代碼來源:AsyncConfiguration.java

示例12: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Override
public Executor getAsyncExecutor() {
    ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
    taskExecutor.setCorePoolSize(corePoolSize);
    taskExecutor.setMaxPoolSize(maxPoolSize);
    taskExecutor.setQueueCapacity(queueCapacity);
    taskExecutor.initialize();
    return taskExecutor;
}
 
開發者ID:V-I-C-T-O-R,項目名稱:DataM,代碼行數:10,代碼來源:TaskExecutePool.java

示例13: getAsyncExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
    log.debug("Creating Async Task Executor");
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
    executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
    executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
    executor.setThreadNamePrefix("torg-crm-Executor-");
    return new ExceptionHandlingAsyncTaskExecutor(executor);
}
 
開發者ID:torgcrm,項目名稱:TorgCRM-Server,代碼行數:12,代碼來源:AsyncConfiguration.java

示例14: bbApiThreadPoolExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean
public ThreadPoolTaskExecutor bbApiThreadPoolExecutor() {
	ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
	pool.setCorePoolSize(corePoolSize);
	pool.setMaxPoolSize(maxPoolSize);
	pool.setAwaitTerminationSeconds(5);
	pool.setThreadNamePrefix("API-ThrP-");
	pool.setRejectedExecutionHandler(new ThreadPoolTaskRejectedHandler());
	return pool;
}
 
開發者ID:BuaBook,項目名稱:buabook-api-interface,代碼行數:11,代碼來源:BuaBookApiInterfaceConfig.java

示例15: getWebServerTaskExecutor

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; //導入方法依賴的package包/類
@Bean(name = "webServerTaskExecutor")
public TaskExecutor getWebServerTaskExecutor(@Qualifier("pollingThreadFactory") final ThreadFactory threadFactory,
                                             @Value("${webserver.thread-task-executor.pool.size}") final int corePoolSize,
                                             @Value("${webserver.thread-task-executor.pool.max-size}") final int maxPoolSize,
                                             @Value("${webserver.thread-task-executor.pool.queue-capacity}") final int queueCapacity,
                                             @Value("${webserver.thread-task-executor.pool.keep-alive-sec}") final int keepAliveSeconds) {
    final ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
    threadPoolTaskExecutor.setCorePoolSize(corePoolSize);
    threadPoolTaskExecutor.setMaxPoolSize(maxPoolSize);
    threadPoolTaskExecutor.setQueueCapacity(queueCapacity);
    threadPoolTaskExecutor.setKeepAliveSeconds(keepAliveSeconds);
    threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
    threadPoolTaskExecutor.setThreadFactory(threadFactory);
    return threadPoolTaskExecutor;
}
 
開發者ID:cerner,項目名稱:jwala,代碼行數:16,代碼來源:AemServiceConfiguration.java


注:本文中的org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor.setMaxPoolSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。