官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 高青县| 新宾| 南乐县| 大渡口区| 长寿区| 阿巴嘎旗| 栾川县| 修武县| 出国| 上高县| 香格里拉县| 曲水县| 邯郸市| 九江县| 永顺县| 油尖旺区| 衡阳市| 洛扎县| 搜索| 凤城市| 揭西县| 鄄城县| 叙永县| 巴里| 石柱| 衡阳市| 衡东县| 祁东县| 万年县| 蓬莱市| 如皋市| 沁水县| 托里县| 略阳县| 聂荣县| 惠东县| 隆昌县| 满洲里市| 扎鲁特旗| 霍邱县| 游戏|