title: How to prevent two users from taking same action on a data record in a web application?
body: <p>We have a web application backed by spring framework which displays list of records to the users. We have a requirement where-in we want to restrict single record being actioned from two users at the same time. i.e. if multiple users are trying to action the same record, request for user which action first is processed rest all should not be able to process it.</p>
  <p>We have looked at locking technique (optimistic locking) but not sure if this is the correct or only approach for achieving this functionality.</p>
  <p>Also, if optimistic locking is the correct approach, any pointers in that direction would be appreciated.</p>