Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Should I catch ClientAbortException  RSS feed

 
William Stafford
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our Tomcat Catalina log shows lots of ClientAbortExceptions. Most seem to be caused by users bailing out before a download is completed. None seem to be causing any problems for users.

Should this exception be caught by the Servlet that is doing the downloading?

Thanks,
-=b
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why? What you do with it?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet engine cleans itself up as much as possible after an exception like that but it can't do everything.

If your download servlet leaves any system resources in the wrong state you may accumulate problems that will eventually crash the server. I am thinking of stuff like:

Database connections left open
Graphics contexts not cleaned up
Files left open
Memory allocations no longer needed but still held somewhere

Good design of your download code would prevent these problems.

Bill
 
William Stafford
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill. That was the sort of thing I was worried about. I guess I did not make it clear that I was worried about the after effects of an aborted download.

Thanks again,
-=b
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, you probably still don't want to catch the exception, but rather be sure to have clean up code in a finally so that there are no resource leakages no matter what happens.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!