0
Hello Guys,
I'm trying to use a Thread Pool Executor in my application and I'm kinda stuck somewhere.
My aim is to create a pool of fixed number of threads (say 10) waiting in the pool to be called for action (say to print hello);
I'm still bad at java, but here is what I have come up with.
public class ThreadPoolExecution { public static void main(String[] args) { BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10); ThreadPoolExecutor ex = new ThreadPoolExecutor(4,10,20, TimeUnit.SECONDS,q); try { //ex.execute(null); } catch(RejectedExecutionException e) { System.out.println(e.getMessage()); } }
What I need is to know, how a plain thread is created, how to create a thread pool, and how to use ThreadPoolExecution.
I have searched the forum, but I haven't found any solution which I found useful. Can you please help me out?
Edited by emclondon: n/a