I have this issue which only appears in production. I suspect a threading issue since it only appears under high load.
In my code there is a Requirements bean:
...that is set into session by a servlet. Right after that servlet sets that bean into session it includes a JSP page which has embedded Ajax which upon loading makes an Ajax call back to the server. This Ajax call calls another servlet on the server which references the Requirements object that was put into session. Once in a while that Requirements object is missing data (or possibly completely missing).
Here is the pseudocode:
Two Questions: 1) When you set a session attribute from a servlet, will that method call "setAttribute" guarantee to finish before the servlet's doPost? 2) When you add members to an ArrayList (rolesToAdd), are these guaranteed to be added by the time the ArrayList is added to the requirements object (which is then added itself to session)?
I know that ArrayList is not synchronized...but I'm not sure if that means that calls to ArrayList.add("obj") are guaranteed to finish before caller moves on. I have the same concern about session.setAttribute, not sure if calls to setAttribute are guaranteed to finish before caller moves on. [ July 26, 2008: Message edited by: James Ellis ]