tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Context Chicken & Egg Problem
Date Fri, 11 Dec 2009 15:08:58 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 12/10/2009 9:08 PM, David Fisher wrote:
> public class UniverseLoader extends HttpServlet {
> 
>     protected long timeLoaded;
> 
>     public void init() throws ServletException {
>         new Thread(new LoadUniverseTask()).start();
>     }
> 
>     public void doGet(HttpServletRequest request, HttpServletResponse
> response) throws ServletException, IOException {
>         response.getWriter().println("Universe loaded: " + new
> Date(timeLoaded));
>     }

So, until your initialization routine finishes, your code reports that
the universe was loaded on "Thu Jan 01 00:00:00 UTC 1970"?

Also, where do you store information about the universe being (properly)
loaded so that your servlets don't try to use missing/unavailable objects?

Finally, you might consider using a ServletContextListener instead of a
Servlet, as this is the recommended practice for context setup. You can
still provide a servlet to report on the status of the load if you'd like.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksiYIoACgkQ9CaO5/Lv0PAYVwCeIQKFynF+BdR0NRdCRYGV/D8E
gKAAn33nUUZPK7ut84Wbk7vU0UebYYZy
=hjHK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message