How to simulate an unhandled exception in Java
Posted
by Martin Wiboe
on Stack Overflow
See other posts from Stack Overflow
or by Martin Wiboe
Published on 2010-06-14T22:19:00Z
Indexed on
2010/06/14
22:22 UTC
Read the original article
Hit count: 342
Hi,
I am creating some multi-threaded code, and I have created a JobDispatcher class that creates threads. I want this object to handle any unhandled exceptions in the worker threads, and so I am using
Thread.setUncaughtExceptionHandler(this);
Now, I would like to test this functionality - how can I generate an unhandled exception in the run() method of my worker object?
Thanks,
Martin
© Stack Overflow or respective owner