I have a Java Servlet that has a repeated code I would put it out into a method to clean the code.
The problem is I have read that could be concurrency problems if I use auxiliary methods.
Is that true?
This is my code, which is repeated several times:
if(session.getAttribute("attemps") == null) {
session.setAttribute("attemps", 1);
}
else {
Integer attemps = (Integer) session.getAttribute("attemps");
session.setAttribute("attemps", attemps + 1);
}
I would create a method with this code inside and then call the method when needed.
Thanks.