Spring Framework ThreadPoolTaskExecutor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ThreadPoolTaskExecutor class.

This code example shows how to use the following methods:setAllowCoreThreadTimeOut, setCorePoolSize, setKeepAliveSeconds, setMaxPoolSize, setQueueCapacity
This code example shows how to use the following methods:setCorePoolSize, setMaxPoolSize, setQueueCapacity, setThreadNamePrefix
    public Executor createAsyncExecutor(@Qualifier(value = "gpTaskExecutorProp") TaskExecutorProperties gpTaskExecutorProp) {
        logger.debug("\n\n########################################Initializing " 
                + "GeoPlatform ThreadPoolTaskExecutor with Properties \n {}\n\n", 
                gpTaskExecutorProp);
 
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(gpTaskExecutorProp.getCorePoolSize());
        executor.setMaxPoolSize(gpTaskExecutorProp.getMaxPoolSize());
        executor.setQueueCapacity(gpTaskExecutorProp.getQueueCapacity());
        executor.setThreadNamePrefix(gpTaskExecutorProp.getThreadNamePrefix());
 
        return executor;
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:setCorePoolSize, setMaxPoolSize, setQueueCapacity, setThreadNamePrefix
 
    @Override 
    @Bean 
    public Executor getAsyncExecutor() {
        log.debug("Creating Async Task Executor"); 
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(propertyResolver.getProperty("corePoolSize", Integer.class, 2));
        executor.setMaxPoolSize(propertyResolver.getProperty("maxPoolSize", Integer.class, 50));
        executor.setQueueCapacity(propertyResolver.getProperty("queueCapacity", Integer.class, 10000));
        executor.setThreadNamePrefix("jhipster-Executor-");
        return new ExceptionHandlingAsyncTaskExecutor(executor);
    } 
 
    @Override 
    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
        return new SimpleAsyncUncaughtExceptionHandler();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:setCorePoolSize, setMaxPoolSize, setQueueCapacity, initialize, setThreadNamePrefix
    } 
 
    @Override 
    public Executor getAsyncExecutor() {
        log.debug("Creating Async Task Executor"); 
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(2);
        executor.setMaxPoolSize(50);
        executor.setQueueCapacity(10000);
        executor.setThreadNamePrefix("TatamiExecutor-");
        executor.initialize();
        return executor;
    } 
} 
6
CodeRank
This code example shows how to use the following methods:setCorePoolSize, setMaxPoolSize, setQueueCapacity, initialize, setThreadNamePrefix
This code example shows how to use the following methods:setMaxPoolSize, initialize, setThreadNamePrefix
		new SpringApplicationBuilder(Application.class).run(args);
	} 
 
	@Override 
	public Executor getAsyncExecutor() {
		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
		executor.setMaxPoolSize(10);
		executor.setThreadNamePrefix("MyExecutor-");
		executor.initialize();
		return executor;
	} 
 
	@Override 
	public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
		registry.addHandler(simpleHandler(), "/endpoint");
		registry.addHandler(registryHandler(), "/registry").withSockJS()
				.setHeartbeatTime(5000); 
		registry.addHandler(chatHandler(), "/chat");
		registry.addHandler(chat4Handler(), "/chat4");
		registry.addHandler(quoteHandler(), "/quotes");
6
CodeRank
This code example shows how to use the following methods:setCorePoolSize, setMaxPoolSize
        return new SimpleJobRepository(jobInstanceDao, jobExecutionDao, stepExecutionDao, executionContextDao);
    } 
 
    @Bean 
    public TaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
        taskExecutor.setCorePoolSize(corePoolSize);
        taskExecutor.setMaxPoolSize(maxPoolSize);
        return taskExecutor;
    } 
 
    @Bean 
    public JobParametersIncrementer jobParametersIncrementer() { 
        return new RunIdIncrementer(); 
    } 
 
    @Bean 
    @Database(Database.Purpose.APPLICATION) 
    public DB applicationDb() throws UnknownHostException {
        return mongo().getDB(appDbName);
6
CodeRank
This code example shows how to use the following methods:setMaxPoolSize, afterPropertiesSet
This code example shows how to use the following methods:setCorePoolSize, setMaxPoolSize, setQueueCapacity
This code example shows how to use the following methods:
	/** 
	 * The asynchronous task executor used by the Greenhouse application. 
	 */ 
	@Bean 
	public Executor taskExecutor() {
		return new ThreadPoolTaskExecutor();
	} 
 
} 
5
CodeRank
See Code Examples for Spring Framework ThreadPoolTaskExecutor Methods: