Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What happens if multiple refresh requests are sent?

 
Alexey Gor
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am confused -

what happens when user repeatedly presses the F5 button (really quickly)?

Does original request keep executing?

What happens to all these bazzilion requests being made?

What happens to the session scope?

thank you!
 
Zip Ped
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A refresh does not affect any request or Session scope variables. A refresh might not be idempotent(by HTTP standards POST is not Idempotent but your implementation might be) if you are using a POST method to send data back to the server.

The request variables do not go out of scope on a refresh as the data being requested from the server on each refresh is the same as the one that was sent in the first request.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does original request keep executing?

Each request will execute in its own Thread as provided by the servlet engine. There is no telling which will finish executing first since they all have the same priority.

Since each request uses the same ID, they all share the same session object. If this is a problem you can synchronize on the session object, thus forcing the other request Threads to wait for access.

Bill
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One request will (probably) send a response back to the browser. The others will find that the browser is no longer interested in any response and get an exception something like connection reset by peer. My Wiki server handled this poorly for a while and banging on refresh was a good way to blow out the stack and write megabytes of log files.
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refresh behaviour also depends on the browser being used. I feel Firefox handles this very nicely. It would queue up all the requests. In case of IE it fires two(or more) seperate requests at the same time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic