Creating Thread dynamically with Spring-boot

0

Good morning,

Is it possible to make spring-boot create thread when needed and also kill it?

    
asked by anonymous 12.07.2016 / 20:33

1 answer

0

Make a note of @EnableAsync in your Application.java and give extends in class AsyncConfigurerSupport . With this it will be possible to create a ThreadPoolTaskExecutor , follow the example below.

 @Override
    public Executor getAsyncExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(2);
        executor.setMaxPoolSize(2);
        executor.setQueueCapacity(500);
        executor.setThreadNamePrefix("GithubLookup-");
        executor.initialize();
        return executor;
    }

Follow the Spring Boot's own guide link: link

    
10.11.2016 / 22:57