- Hands-On Enterprise Java Microservices with Eclipse MicroProfile
- Cesar Saavedra Heiko W. Rupp Jeff Mesnil Pavol Loffay Antoine Sabot Durand Scott Stark
- 63字
- 2021-06-24 12:56:23
The @Asynchronous policy
Making an operation asynchronous is as simple as the following:
@Asynchronous
public Future<Connection> service() throws InterruptedException {
Connection conn = new Connection() {
{
Thread.sleep(1000);
}
@Override
public String getData() {
return "service DATA";
}
};
return CompletableFuture.completedFuture(conn);
}
The only constraint is to have the @Asynchronous method return Future or CompletionStage; otherwise, the implementation should throw an exception.
推薦閱讀
- 網絡教育學習指導
- 面向物聯網的CC2530與傳感器應用開發
- 物聯網之魂:物聯網協議與物聯網操作系統
- 計算機網絡與數據通信
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- 網絡環境中基于用戶視角的信息質量評價研究
- Echo Quick Start Guide
- 通信十年:擁抱互聯網
- 語音信號處理及Blackfin DSP實現
- Getting Started with nopCommerce
- 現代通信系統(第5版)
- 5G智慧交通
- 黑客與反黑工具使用詳解
- Corona SDK Application Design