About Question com.enthuware.ets.scwcd.v5.2.526 :
Posted: Sat Feb 18, 2012 10:03 am
Question:
Consider the following servlet code:
import javax.servlet.*;
public MyServlet extends GenericServlet implements Runnable
{
public void run()
{
//do something.
}
}
Which of the following statements are correct?
One of the answers to the question is: "Assuming that compilation errors are rectified (if any), the servlet container can run multiple threads simultaneously on the same instance of this servlet.".
Isn't it true however that creation of threads is not supported by the J2EE spec, and in fact is strongly discouraged? Wouldn't the answer therefore be: "Assuming that compilation errors are rectified (if any), the servlet container CANNOT run multiple threads simultaneously on the same instance of this servlet."?
Consider the following servlet code:
import javax.servlet.*;
public MyServlet extends GenericServlet implements Runnable
{
public void run()
{
//do something.
}
}
Which of the following statements are correct?
One of the answers to the question is: "Assuming that compilation errors are rectified (if any), the servlet container can run multiple threads simultaneously on the same instance of this servlet.".
Isn't it true however that creation of threads is not supported by the J2EE spec, and in fact is strongly discouraged? Wouldn't the answer therefore be: "Assuming that compilation errors are rectified (if any), the servlet container CANNOT run multiple threads simultaneously on the same instance of this servlet."?