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

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.

主站蜘蛛池模板: 神木县| 晋宁县| 水城县| 太康县| 松滋市| 平度市| 奉新县| 凉城县| 灯塔市| 若羌县| 隆昌县| 顺义区| 丰台区| 祁东县| 达尔| 罗源县| 通海县| 吴旗县| 葫芦岛市| 略阳县| 博野县| 海阳市| 南郑县| 黄龙县| 错那县| 泰宁县| 巍山| 青浦区| 湖州市| 固始县| 蚌埠市| 青岛市| 安达市| 双鸭山市| 岳阳县| 太和县| 宽甸| 岗巴县| 安丘市| 承德市| 丘北县|