每一个Servlet只有一个实例,多个线程:
Servlet:
package com.stono.servlet.synchronize; import javax.servlet.http.HttpServlet; public class TestServletC extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException { System.out.println(this); }; }
使用不同的浏览器进行访问,其打印出来的内容是一致的;
时间: 2024-10-10 07:55:26