0

I have created two API endpoints using Spring Boot.

Ist endpoint: Does some get operation.

IInd endpoint:Overwrites a Mongo DB Collection.

My aim is to prevent concurrent access for multiple users for this second endpoint. And I don't want to block concurrent access to first endpoint.

Both my endpoints are under same controller.

  • Use optimistic-locking if in your application there are fewer chances of triggering an update for a shared document by many concurrent threads.... optimistic locks don't block and hence faster but if there multiple requests for a given document failed due to optimistic locking then retry cost would be there. – Sahil Gupta Sep 06 '21 at 04:43
  • Please provide enough code so others can better understand or reproduce the problem. – Community Sep 08 '21 at 09:30

0 Answers0