Problem solve Get help with specific problems with your technologies, process and projects.

Session objects and synchronized blocks -- is there a better way?

Recently, while doing some consulting work for a new customer, I ran into a problem where a second request from the same Web-client (browser) would be received by a servlet before the first request was finished processing. Come to find out, this would happen when the user would hit the refresh button on the browser before the first request was finished. We solved the problem using a complex mixture of session objects and synchronized blocks. Do you have any suggestions for doing this any other way?
The solutions that you mentioned work for most situations. However, this type of problem is generally the result of failure to provide some kind of feedback to the user when a form is submitted or when they must wait too long for the results of a submission. For this type of problem, I advise taking the user immediately to a "Please wait" type of page to let the user know that their submission is being processed. This also eliminates a duplicate request being send if they hit the refresh button.

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.