我有一组 Callables 和一个 ExecutorService。当我调用All 时,我得到一个Future 对象列表。在 Future 完成之前,如何判断哪个 Future 对象映射到哪个 Callable?事后我可以告诉你,因为
代码:
ExecutorService es = .....;
Collection<Callables> uniqueCallables = .....; // each Callable is unique!
List<Future> futures = es.invokeAll(uniqueCallables);
// TODO--find unique Future A which is the future for Callable A!