Y
yancheng.cheok
Hello, may I know how can I wait for all the threads in a fixed thread
pool to be completed, without calling shutdownNow?
Executor pool = Executors.newFixedThreadPool(nThreads);
for(int i = 0; i < 10000; i++)
pool.execute(new StockHistoryRunnable(code));
// blah blah blah
//
// I would like to wait for all the 10000 task to be completed. There
is a method named
// awaitTermination. However, in order to use the method, I have to
first call shutdownNow.
// I do not want to do so, because I need to re-use the pool later.
//
Thanks!
cheok
pool to be completed, without calling shutdownNow?
Executor pool = Executors.newFixedThreadPool(nThreads);
for(int i = 0; i < 10000; i++)
pool.execute(new StockHistoryRunnable(code));
// blah blah blah
//
// I would like to wait for all the 10000 task to be completed. There
is a method named
// awaitTermination. However, in order to use the method, I have to
first call shutdownNow.
// I do not want to do so, because I need to re-use the pool later.
//
Thanks!
cheok