A few weeks ago our Jetty startup time went from 8 seconds to over 60. We discovered it was searching every class in every jar in WEB-INF/lib and WEB-INF/classes for the JEE annotations, e.g. annotations such as @WebFilter which replace fragments inside the web.xml file. This is normal behavior, according to many sources, and no fault of Jetty’s. However, a quick search for javax.servlet.annotation showed that we were not using any of these. Adding ‘metadata-complete=”true”‘ to our web.xml’s web-app restored our startup time to 8 seconds.
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true" version="3.0">
This attribute tells the container that the web.xml contains the complete configuration. I think this is a fairly well-known topic, but worth (re)posting if it saves someone else some time.
This approach is not specific to this jQuery plugin; any client side timeout can use this method. Also, it has the nice quality of respecting any changes made through an application server console, e.g. temporarily overriding the value seeded by in web.xml.