I have a problem that i make a spring mvc based web application in which multiple user wants to access my application simultaneously to perform operation.
I used some global constant in which i assign ip,port and other information for a particular user like CAConstant.IP, CAConstant.PORT
etc.I use these constant in different class to perform operation based on particular user.
The problem is that when multiple user access application concurrently then last user overwrite the global content of previous one that create conflict in final report(when my main function was not synchronized).
So my problem is how can i resolve this problem or how we can allow multiple user to access same web application concurrently using thread in java?
Use HttpSession to store per user informations.
To put information in session
request.getSession.setAttribute("CAConstantIp", ip_address);
To get attribute from session
String ipAddress = request.getSession.getAttribute("CAConstantIp");
Also have a look at spring guide for HttpSession .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.