• 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

Catch Error After Response Sent?

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A colleague and I recently had the following discussion.

A servlet gets a request, completes it's processing, completes the service method and then there is a network error. For example, the servlet does seven or eight large DB operations that takes a total of about 5 seconds, during that five seconds somebody kicks out the network connection on the App server. He said that the servlet could then catch the error and we'd be able to log the information that the client never got the response.

I said that it wasn't possible since the service method would still complete and then try and send out response...and that it would never know that there was a network error and that client didn't get the response.

Who is correct?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ha ha... nice.

He's right but I think you right too

TCP is a guarenteed protocol, so the second you screw that connection around, if the buffer has not cleared and socket loses the connection it will throw an exception...
If it was UDP you would be right.

... but on a servlet container like Tomcat I dont think the application will see it unless you trap the exception... the message will be in some obscure log file.

The reason they cant crash the app is because if the servlet is taking a long time and the user gets bored and closes the browser, the same think happens... but its just a log message.

Take each other to lunch
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic