Hi Chris,
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"?
Good point. We only use the servlet for debugging. So, we haven't
fixed this obvious bug.
Also, where do you store information about the universe being
(properly)
loaded so that your servlets don't try to use missing/unavailable
objects?
Hidden in the details that I cut out is a call to another class, we
check to see if that class has completed its task via an "isLoaded"
boolean.
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.
Thanks for the tip, I'll add it to our internal JIRA for additional re-
factoring as we re-architect to go to Tomcat 6 from Tomcat 5.5. We
share this universe between webapps on the container for historical
reasons. We hope for horizontal scale and Tomcat 6 anywhere. We'll
need each of our apps to be an independent WAR to scale each
individually.
Current architecture is to share a jar in shared/lib between the main
webapps, an admin webapps and a localhost only management webapps.
This was originally in Tomcat 3. New architecture will separate each,
drop the management webapps and we'll control contexts via
multicasting, jmx, and/or servlets.
Regards,
Dave
- -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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org