Vaadin7 : Load a file one time for all users

Dear Vaadin community,

I am building a
Vaadin7
application which, among other things, loads a XML file which is the same for all the users.
If i load this file from the init() method, then if 1000 users open a session, the file will be loaded 1000 times, isn’t it ?
How to load the file one time rather than 1000 times ???

Eric

Why don’t you use a static method that does this. Also, you may require a static variable to keep the status so that it will be done only once.

For web app initialization, you should consider the web standard method for initializing it via a ServletContextListener as it’s invoked once when your webapp is started via public void contextInitialized(ServletContextEvent sce), and once on shutdown via public void contextDestroyed(ServletContextEvent sce).

Thank you Syam and David

ServletContextListener doesn’t work for me because of an issue described here :
https://vaadin.com/forum#!/thread/3855161

So i use the “static” keyword, it works fine.

Eric