Вот фрагмент кода.Приложение запустится, как только я перезапущу приложение, но через 20-30 минут приложение снова зависнет.
- класс обслуживания
@Async("defaultExecutor")
public void process(Request req) {
/// application logic
}
@Configuration
@EnableAsync
public class AsyncConfiguration implements AsyncConfigurer {
@Bean("defaultExecutor")
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(20);
executor.setRejectedExecutionHandler(new
ThreadPoolExecutor.CallerRunsPolicy());
executor.setWaitForTasksToCompleteOnShutdown(true);
executor.initialize();
return executor;
}
}
This app will run as an async process and updates the database and sends notifications.
журналы:
2018-09-25 11:02:33 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing expired connections
2018-09-25 11:02:33 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing connections idle longer than 60000 MILLISECONDS
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing expired connections
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing connections idle longer than 60000 MILLISECONDS
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing expired connections
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing connections idle longer than 60000 MILLISECONDS
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing expired connections
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing connections idle longer than 60000 MILLISECONDS
2018-09-25 11:02:38 [idle_connection_reaper] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Closing expired connections