R
Rob Whiteside
Hi,
The "init" method for a servlet provides a place for you to do things
during the Web Server's startup. Is there a way to know when the Web
Server has completely finished starting up and is forwarding requests
to its servlets?
My situation is this:
When my servlet starts, it needs to populate the database with some
data that it grabs from another web service. The interaction with
that web service is such that I send it a request for data, and the
web service immediately responds, then later it sends the data to my
servlet via http post/SOAP.
The problem is that when I send that request for data in the servlet's
init method, I have no guarantee that my Web Server is actually
started and receiving requests. So, if the external web service posts
its data to me right away, I never get it.
I wish there was another method in the servlet that got called when
the web server startup was complete.
currently, my solution is to spawn a thread in my init method that
sends requests to myself over and over until I get a valid response
code.
I was hoping that I was missing a simpler solution (and one slightly
less hokey).
Currently I am using Apache Tomcat, but the solution must be generic
to all web servers
Thanks for your help!
The "init" method for a servlet provides a place for you to do things
during the Web Server's startup. Is there a way to know when the Web
Server has completely finished starting up and is forwarding requests
to its servlets?
My situation is this:
When my servlet starts, it needs to populate the database with some
data that it grabs from another web service. The interaction with
that web service is such that I send it a request for data, and the
web service immediately responds, then later it sends the data to my
servlet via http post/SOAP.
The problem is that when I send that request for data in the servlet's
init method, I have no guarantee that my Web Server is actually
started and receiving requests. So, if the external web service posts
its data to me right away, I never get it.
I wish there was another method in the servlet that got called when
the web server startup was complete.
currently, my solution is to spawn a thread in my init method that
sends requests to myself over and over until I get a valid response
code.
I was hoping that I was missing a simpler solution (and one slightly
less hokey).
Currently I am using Apache Tomcat, but the solution must be generic
to all web servers
Thanks for your help!