0
我有以下代碼:獲取期貨的ID在Java中
for (int i = 0; i < nComp; i++) {
Callable<Long> worker = new WSCaller(compConns[i]);
col.add(worker);
}
List<Future<Long>> results=null;
results = executor.invokeAll(col, timeout, TimeUnit.SECONDS);
for (Future<Long> future : results) {
if (!future.isDone()) {
// here I need to know which future timed-out ...
}
}
如上代碼中指出...我怎樣才能知道哪些未來超時?
感謝
可能重複環?](http://stackoverflow.com/questions/477550/is-there-a-way-to-access-an-iteration-counter-in-javas-for-each-loop) – 2011-04-15 18:48:11