Is there any way to know when a war is being hot deployed so I can shutdown the old executor that is running scheduled tasks? I’m using jboss 6 and I have a scheduled thread pool that is updating data periodically in the background. When I hot deploy that thread pool is not shutdown and new starts up so I have multiple scheduled thread pools.
Thanks for any input.
Yes, but it depends on where you start your
Executorand which technology you use:in ServletContextListener: start
ExecutorincontextInitialized()and shut it down incontextDestroyed().in servlet, start
Executorininit(), shut it down withdestroy()in EJB/Spring bean: start in method annotated with
@PostConstruct, shutdown in@PreDestroy.