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.
推薦閱讀
- 異構基因共表達網絡的分析方法
- 物聯網安全與深度學習技術
- 走進物聯網
- 計算機網絡工程實用教程(第2版)
- Wireshark網絡分析就這么簡單
- SSL VPN : Understanding, evaluating and planning secure, web/based remote access
- Kong網關:入門、實戰與進階
- OMNeT++與網絡仿真
- 6G:面向2030年的移動通信
- 物聯網的機遇與利用
- 華為HCIA-Datacom認證指南
- 從物聯到萬聯:Node.js與樹莓派萬維物聯網構建實戰
- Python Web Scraping Cookbook
- INSTANT Social Media Marketing with HootSuite
- 互聯網心理學:新心理與行為研究的興起