BlockingQueues and Thread Pools#
I've reworked the previous BlockingQueue example to use a thread pool. Suppose you wanted to decompose your input into a large number of different types, you would end up with an excessive number of threads if you tried to have one thread for each type. The example code below uses the poll method of BlockingQueue with a timer. When the poll expires, the thread wrapping the worker is interrupted and is returned to the thread pool to be reused.- threadrunner-pool-20100525.jar
(2010-05-25 @ 20:41:54 PDT)
Add new attachment
Only authorized users are allowed to upload new attachments.
