Back to project page androidcodes.
The source code is released under:
GNU General Public License
If you think the Android project androidcodes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.pract.threadpool; //from w w w .j av a 2 s . co m public class ThreadPoolManager { private final int THREADPOOL_CAPACITY; private MyQueue<Runnable> myQueue = new MyQueue<Runnable>(); public ThreadPoolManager(int capacity){ this.THREADPOOL_CAPACITY = capacity; initAllConsumers(); } private void initAllConsumers(){ for(Integer i = 0; i < THREADPOOL_CAPACITY; i++){ Thread thread = new Thread(new Worker(myQueue, i.toString())); thread.start(); } } public void submitTask(Runnable r){ myQueue.enqueue(r); } }