The above application could go out of memory if the randomIntvalue variable never achieves its desired value. Or in logical terms, the poll never gets over. So this thought could also be presented with a ThreadPool. I have built a Thread Pool of capacity 10 using java.util.concurrent.ExecutorService. If the thread does not have an explicit uncaught exception handler set, and the thread's thread group (including parent thread groups) does not specialize its uncaughtException method, then the default handler'suncaughtExceptionmethod will be invoked.By setting the default uncaught exception handler, an applicationcan change the way in which uncaught exceptions are handled (such as logging to a specific device, or file) for those threads that wouldalready accept whatever behavior the system provided. This post is written by
Komal Ahluwalia - Linkedin, Google Plus
She is a freelance writer, loves to explore latest features in Java technology.