Scenario: Apache Wicket based web application running on Tomcat server.
User opens URL in browser, session is created and simple main page is shown in browser, user clicks on button and AJAX call is invoked. Application gets request and doing some stuff preparing response. In same time user or JavaScript in browser invokes another AJAX call -- this second requests is processed in another thread in application, and because most parts of application are session specific and aren t thread-safe (because one user = one session), exception throws.
Possible solutions:
make all application classes thread-safe (very costly)
adapt GUI so no simultaneously runs two AJAX calls in one session (not possible due nature of browser GUI)
synchronize all requests in one session on Wicket or Tomcat level (but how?)
another practice or technique ???
Thanks