You are building a servlet that requires high speed numerical computations of weather data before generating a PNG image of the data. There is a dedicated server that performs these computations and your servlet needs to send these requests over a TCP socket connection to this server. Your servlet needs to
manage that socket connection which must be set up once for the duration of life of the servlet. Furthermore, the server's IP address and TCP port information is stored in the web.xml file in the servlet initialization parameters
Which two parts of the servlet life cycle should you use to create the code to handle this scenario? (Choose two.)
1/servlet is destroyed
2/servlet is finalized
3/servlet is initialized
4/servlet class is loaded
5/servlet is instantiated
6/servlet responds to HTTP requests
Let's start by you trying to provide an answer (even if it different from the given one).
Joined: Sep 08, 2012
suppose they did not ask for 2 answers,
I would put all the servlet lifecycle listed( 4/servlet class is loaded , 5/servlet is instantiated , 3/servlet is initialized , 1/servlet is destroyed) and why not 6/servlet responds to HTTP requests as it is the purpose of servlet
Joined: Mar 22, 2005
As I understand it, the question is just about managing the socket connection to the server, not about handling requests (and thereby actually using the connection).