Java 6 has built-in support for thread pools in the package java.util.concurrent, also available for older version in backport-jsr166.
BTW, if you need a ThreadPoolExecutor that blocks when the underlying queue is full, then implement a RejectedExecutionHandler that, in rejectedExecution(Runnable r, ThreadPoolExecutor executor) calls executor.getQueue().put(r). Somehow, none of the classes provided in the package does that for you.
Published on June 21, 2009 at 09:14 EDT
Older post: Flushing Queue
Newer post: FQ2: Hudson, A Continuous Integration Engine