• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Effects of pressing the Browser's Stop to the Servlet

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic