我正在使用以下代码:
public CompletionStage<Result> list(int page, String sortBy, String order, String filter) {
// Run a db operation in another thread (using DatabaseExecutionContext)
return computerRepository.page(page, 10, sortBy, order, filter).thenApplyAsync(list -> {
// This is the HTTP rendering thread context
return ok(views.html.list.render(list, sortBy, order, filter));
}, httpExecutionContext.current());
}
由于编写了thenApplyAsync,因此客户端如何收到此结果。生成新线程后,客户端是否不会立即返回。