Reputation: 2528
If an error / exeption is thrown in a thread (not a main one) can this halt the whole application ?
Is there such possibility ? Or will this just stop the thread it was running in ?
Upvotes: 5
Views: 2279
Reputation: 11996
In addition to Peter Lawrey's answer, there's one more case when unhandled exception can cause application freeze: if died thread had grabbed some lock needed by other threads of program.
Upvotes: 2
Reputation: 533520
If an error / exeption is thrown in a thread (not a main one) can this halt the whole application ?
It will if it causes the only non-daemon thread to return from run()
If there are other non-daemon threads running or the exception or error is caught and handled, the application will keep running.
will this just stop the thread it was running in ?
if the exception or error is caught and handled it might not stop any threads.
Upvotes: 4