i have web service receives data clients , saves them map
@controller public class examplecontroller { private final map<string, string> state = new concurrenthashmap<>(); @requestmapping(value = "/set-state", method = requestmethod.post) public synchronized @responsebody void setstate(@requestparam string id, @requestbody string updateddata) { state.put(id, updateddata); } }
suppose client sends 2 requests 1 after another. both requests have same id, second request has updated data.
the question is, spring mvc guarantee setstate
called request 1 data first? making method synchronized enough make sure i'll updated data request 2 in state map?
Comments
Post a Comment