java.util.concurrent.ExecutorService //sub interface of Executor (the method execute() )
ex :
ExecutorService pool = Executors.newFixedThreadPool(5);
Thread t1 = new Thread();
...
...
Thread t5 = new Thread();
pool.execute(t1);
pool.execute(t2);
pool.execute(t3);
pool.execute(t4);
pool.execute(t5);
pool.shutdown();
///
newCachedThreadPool() resizeable
newSingleThreadExecutor() nomo thread
No comments:
Post a Comment