import javax.servlet.*;
import javax.servlet.http.*:
public class TestServlet extends HttpServlet implements SingleThreadModel {
private HashMap hm = new HashMap();
public void doGet(HttpServletRequest req, HttpServletResponse res) {
//lot of code.
}
}
Which of the following statements are correct?
a) 'hm' is
thread safe
b) 'hm' is not thread safe
c) 'req' is thread safe
d) Making 'hm' static would make it thread safe.
e) 'hm' can be made thread safe only if it is made final.
Ansewrs given is a) and c)
How come a) is correct? In SingleThreadModel it may create more than one instance right??