What is the best way to restrict concurrent user access in any web application?
Existing problem:
We have different reports in our web application. if one user is accessing any report we must not allow other users to access the same report. How can we achieve this?
Proposed solution:
- create singleton class which will hold the report info object with report type and date so if user first time accesses report create this singleton object with current time
- if user keeps open this report without doing any operation after 30 min the scheduler will close this report.
- if other user is trying to access same report by checking the singleton object is containing the report info or not if not we are allowing.
Is this approach the best or is there any better approach? What are the best ways we can achieve this?