I’m wondering if Spring requests are synchronized. Here is my scenario:
I have a request that gets mapped to a Controller1, which by itself calls my DAO1.aMethod().
Lets say another user calls the same method and another request gets mapped by Controller1 to DAO1.aMethod() BEFORE the first call to DAO1.aMethod() returned a value.
Im asking this, because i have a DAO that runs a complex algorithm with calculations and im curious if another call from another user could interfere with a calculation if he starts another one.
Testing from my side shows, that if a keep a field in my DAO say ‘iRunsCalculation’ and track the actual status, the second request can read the status set by request one.
I am assuming that by ‘synchronized’, you mean, do they run simultaneously or do they queue. They certainly can run simultaneously, that is how a web container is generally meant to work. Spring doesn’t really have much to do with what is going on here, as it would be your servlet container that fields incoming requests and drops them off to the Spring
DispatcherServlet.If your calculations somehow depend on current and past calls to this service, it is likely that can run into some ‘synchronization’ issues if you are not properly protecting your synchronization.