• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Effects of pressing the Browser's Stop to the Servlet

 
Yoo-Jin Lee
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could anyone give me their thoughts on what happens when a servlet connects to a database (ie SQL Server) and in the middle of doing all it's sql statements the user clicks the "stop" button on the browser.
Will the the servlet stop right there? So it will not reach it's close connection command? Hence, there will be openned connections. I think this is the case.
Or else will the servlet just keep on running anyways and finish as though nothing happened?

Thanks.
Yoo-Jin.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the servlet will see an IOException when it tries to write to the connection to the user's browser. What happens after that depends on your Exception handling.
I don't think the connection to the database will be affected but you ought to have Exception handling built in to ensure that it will be closed. A finally clause is always nice.
WBB
 
Frank Lin
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion, this would not have any effect on the servlet because the content generated by servlet is delivered thru the HTTP server. The servlet would not know a browser has terminated the request session so it will continue to run and sends the HTML page to the HTTP server as usual.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic