Kortsoft

Monday, December 12, 2005

java.util.concurrent.Executors: "I think java.util.concurrent.Executors (and related functionality like Futures) is one of the best features of JDK 1.5.

One small feature I'd like, though - a newCachedThreadPool(int nThreads) factory method that combines the features of newCachedThreadPool() and newFixedThreadPool(int nThreads). It would create a thread pool that creates new threads as needed up to the number specified by nThreads reusing previously constructed threads when they are available.

This functionality is available directly in java.util.concurrent.ThreadPoolExecutor, but a factory method would be delightful. Surely I'm not the only person who would find a thread pool with a max limit on size that shrinks after use more useful than either a FixedThreadPool or an unbound CachedThreadPool?"

0 Comments:

Post a Comment

<< Home