Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does unhandled exceptions affect JVM?

Tags:

java

exception

My project got like 20 unhandled exceptions, doesn't matter why, and I was wondering how do they affect the JVM? It doesn't crash, but I'm still wondering what are their footprint in JVM. Where do they go?

like image 446
Rihards Avatar asked Dec 21 '22 11:12

Rihards


1 Answers

All exception are handled either by your code or by the "uncaught exception handler" The only way to avoid handling an exception is to return from a finally block or exiting the program.

An unhandled exception/error will result in the end of the running thread. However it this is acceptable response, there is no reason this needs to upset your application.

One problem with Exceptions is they have some overhead and if you create excessive numbers of them it can hurt performance.

like image 150
Peter Lawrey Avatar answered Dec 29 '22 01:12

Peter Lawrey