Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Diagnosing Java Code: The Orphaned Thread bug pattern

Share this post!
 Vote this!

In multithreaded code, it is often common to use a single, master thread that drives the actions the other threads take. This master thread may send messages, often by placing them on a queue, that are then processed by the other threads. But if the master thread throws an exception, the remaining threads may continue to run, awaiting more input to the queue, causing the program to freeze. In this installment of Diagnosing Java Code, full-time Java developer and part-time exterminator Eric Allen discusses detecting, fixing, and avoiding this bug pattern.
Writing code with multiple threads can be quite advantageous to programmers. Multiple threads can make the programming (and the program) go much faster, and the code can use resources much more effectively. However, as with most things in life, there are drawbacks. Because multithreaded code is inherently non-deterministic, the potential for errors is much greater. What's more, the errors that do occur will be much harder to replicate and, therefore, tougher to pin down. more...

0 comments:

Post a Comment