I am trying to build an e-commerce java web application, I am running into an issue for booking/purchasing items from the store. Each item can only be purchased once, my issue is that users on two different machines might be purchasing the same item, and for that I was thinking of synchronization. I don’t quite understand synchronization and how the application can still run when no one is using it. Does the application run on server side? Can someone please give me some information on this?
Share
One of the possible ways is to lock the field in the database. Locking in the database will prevent it to be used from any application that tries to access it. If you use lock, “synchronization” , from the server side app, you must be sure that only that app have access to the database or you could sell the same product twice. Some study about your database lock mechanism maybe can help you to prevent this issue.