in the google engine, your java code runs in a servlet environment. that way you could define listeners to boost your startup code. To do this, you need to implement your startup code in the listener and define the listener in your web.xml:
class listner:
package test; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class MyContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) {
web.xml:
<web-app> <listener> <listener-class>test.MyContextListener</listener-class> </listener> </web-app>
happymeal
source share