Search code examples
web-applicationswebglassfish-3

How to prevent web page from being viewed while my code is updating its content


So basically I have created a web page and my server side code runs every 20 minutes to update the content of the web page. The update usually take about 10-15 seconds (lots of data).

Now what happens if a user tries to access the web page while it's being updated? Can I prevent a user from viewing the webpage during the update? Or is there a better way to ensure the user will not get a partial updated web page?

I am using glassfish as my web server.


Solution

  • In short: if there is a heavy update process, I would look on some type of notification service messaging to provide feedback to user. An informative message like: "Latest data is in the process of being generated. Please visit back in 10 minutes."

    You may also provide a pop-up to allow user to subscribe for a notification through email or something else once updated information is ready for view.