How can I create a thread pool?

John Zukowski

The Executors class of the java.util.concurrent class offers newCachedThreadPool(), newCachedThreadPool(ThreadFactory threadFactory), newFixedThreadPool(int nThreads), newFixedThreadPool(int nThreads, ThreadFactory threadFactory), newScheduledThreadPool(int corePoolSize), and newScheduledThreadPool(int corePoolSize, ThreadFactory threadFactory) for creating an ExecutorService to use as a thread pool. Just give the pool a Runnable object to run with its execute() method.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact