Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

what happens when user clicks stop button of browser  RSS feed

 
Ravinder Rana
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a user requests some resource from server, server will create a new thread and will call service() method of the requested servlet. Now, suppose the servlet is in middle of doing a DB transaction etc. and user clicks the stop button. Now what will happen on server side? Because now we can't send response to client so will container terminate this thread or something else? How a container is supposed to handle this situation?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Octavian Cool",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container has no way of handling this, because it will never know that the user clicked Stop. That button simply instructs the browser to stop listening to whatever response might get sent back, but it doesn't contact the server with anything.
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is some solution which may help. If you are in long operation you can periodically send something in client like HTML comments and check IO status. If you found some errors, then more likely a user stopped browser or some other connection problems happened. Note that you need to flush all out to make sure that they reach a browser.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!