[Solved] Why my servlet do not creates a new thread on a request? [closed]
Declare the variable OUTSIDE a the get/post method scope, you will then be able to increment it on each call to the servlet. See below: private int counter; private Object lock; public void init() throws ServletException{ //init lock lock = new Object(); // create variable counter = 0; } public void doGet(HttpServletRequest request, HttpServletResponse response) … Read more