Hi
Everything is working fine but when I don't know why the ContextClosedEvent is fired 3 times when I shutdown my Spring web application.
[16:29:55] INFO [TEST] - SHUTDOWN TASKS[http-bio-8084-exec-2]
[16:29:55] INFO [TEST] - SHUTDOWN TASKS[http-bio-8084-exec-2]
[16:29:55] INFO [TEST] - SHUTDOWN TASKS[http-bio-8084-exec-2]
Any ideas? Many thanks!
Code:@Component public class ContextClosedEventHandler implements ApplicationListener<ContextClosedEvent> { private static final Logger logger = Logger.getLogger("[TEST]"); @Autowired private ThreadPoolTaskExecutor taskExecutor; @Autowired private ThreadPoolTaskScheduler scheduler; @Override public void onApplicationEvent(ContextClosedEvent e) { logger.info("SHUTDOWN TASKS["+ Thread.currentThread().getName()+"]"); taskExecutor.shutdown(); scheduler.shutdown(); } }


Reply With Quote