开发者

Concurrent user restriction in a web application

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开发者_如何学Go we are allowing.

Is this approach the best or is there any better approach? What are the best ways we can achieve this?


I am not sure if by reports you mean some screen in your web application. In that case, you could create a table in a database to track user access to reports. A user can access a report only if it is available or own by him. A report gets freed when the user leaves the screen or his session ends, you can create a session listener and a context listener that cleans up ownership of reports.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜