我想将集合传递给Promise<WS.HttpResponse>
承诺waitAll
。因此,例如,我不想传递r1
,r2
和,而是将其添加到列表或集合中并将它们传递给. 请帮忙r3
waitAll
公共类 AsyncTest 扩展控制器 {
public static void remoteData() {
F.Promise<WS.HttpResponse> r1 = WS.url("http://example.org/1").getAsync();
F.Promise<WS.HttpResponse> r2 = WS.url("http://example.org/2").getAsync();
F.Promise<WS.HttpResponse> r3 = WS.url("http://example.org/3").getAsync();
F.Promise<List<WS.HttpResponse>> promises = F.Promise.waitAll(r1, r2, r3);
// Suspend processing here, until all three remote calls are complete.
List<WS.HttpResponse> httpResponses = await(promises);
render(httpResponses);
}
}