其中 ExecutorService 為一個 create thread 的東東, 需要再研究.
{{{
Future[] futures = new Future[numThreads];
Operator[] operators = new Operator[numThreads];
ExecutorService es = Executors.newCachedThreadPool();
for (int i = 0; i < numThreads; i++) {
operators[i] = new Operator(subLists[i], mode, flag);
futures[i] = es.submit(operators[i]);
}
}}}
2.
特別的是 Callable
- 類似 Thread 方式
/**
*
Operator
is a thread for sequencial job operation.*
* @author hclee
*/
class Operator implements Callable
- {
public List call() {
}
}
沒有留言:
張貼留言