简体   繁体   中英

ServletContext initialize Timeout

At deployment time we can do post-deployment action by overriding the method contextInitialized(ServletContextEvent sce) of the ServletContextListener .
Now we have the case that the action needs more time . So the deployment fails by a timeout ( java.util.concurrent.TimeoutException exception).
The time which is needed depends on the executed action . In the method we can compute the amout of time and would prefer to set the timeout there.
A possibility is to trigger the action and execute asynchronous. But this means extra effort.
The question is, is there a possibility to change the timeout programatically or is this a bad idea?

Example code:

  @WebListener
  public class PostDeployAction implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
      final ServletContext svtctx = sce.getServletContext();
      // do something that needs more time
    }
  }

On wildfly application server the deployment fails by error WFLYDC0074.

For wildfly one solution is to increase the value of system property jboss.as.management.blocking.timeout

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM