Concurrency is one of the major issues during development of n-tier Web Applications since Client-side & Server-side work independently.
Concurrency is typically handled on the Server-side. We can either keep a version number or maintain a timestamp for every record.
- Handle Concurrency by maintaining a timestamp (Shown visually below)
- Handle Concurrency by maintaining a version number
Every time a record is updated in database, version number is incremented. We send the version number from client to server and vice-versa. Before updating on server we check if the version number in Database is greater than the one from client. If yes, it means somebody has already updated the record and we simply, show appropriate warning message. No update operation is allowed whatsoever.
Login