java - Is there only one servlet object per tomcat server? -
I did a simple test, and executed my test servlet below with various browsers and command line tools. Even if I execute it, it shows the same "yes time" I am perfectly fine with this, I just want to know two things:
a) If I I can count on different versions of Tomcat (today I use version 7.54)
b) What does this mean that a servlet is never parallel in different threads (i.e. those two Request a lot of servlet at the same time Public domain test2 extends HttpServlet {Private string test = "baaa."); WebServlet {name = "test servlet 2", urlPatterns = {"/ test2"}, loadOnStartup = 1) . :-( "@Override Public Zero Init (ServletConfig config) throws" ServletException "{debug (" server starts "); this.test =" hohoho "+ System.currentTimeMillis ();} protected zero doGet (HttpServletRequest request, HttpServletResponse resp) Throws ServletException, IOException {ServletOutputStream Out = resp.getOutputStream (); out.write (test.getBytes ()); Out.flush (); out.close ();}}
is. Yes, at least on the badge 7 forwards. For badge 6 ( annotation support ), you will have to check the specs.
B ) Regarding execution in parallel formula, servlet should not use threadsafe, thread protection, servlet service (to ensure) by default, Member variables, unless the thread is protected from these member variables.
For more information on thread protection:
Comments
Post a Comment