我想使用CompletableFuture
异步供应商运行下面发布的三种方法,这样,当 Executor 完成时,Futurelist
应该分别包含从这三种方法返回的三个值。我知道如何使用Futurelist
,例如:
futureList = CompletableFuture.supplyAsync()
但就我而言,我想要类似的东西:
futureList.add(CompletableFuture.supplyAsync())
请让我知道我该怎么做。
方法:
this.compStabilityMeasure(this.frameIjList, this.frameIkList, SysConsts.STABILITY_MEASURE_TOKEN);
this.setTrackingRepValue(this.compTrackingRep(this.frameIjList, this.frameIkList, SysConsts.TRACKING_REPEATABILITY_TOKEN));
this.setViewPntRepValue(this.compViewPntRep(this.frameIjList, this.frameIkList, SysConsts.VIEWPOINT_REPEATABILITY_TOKEN));
compStabilityMeasure 方法实现:
private void compStabilityMeasure(ArrayList<Mat> frameIjList, ArrayList<Mat>
frameIkList, String token) throws InterruptedException, ExecutionException {
// TODO Auto-generated method stub
synchronized (frameIjList) {
synchronized (frameIjList) {
this.setRepValue(this.compRep(frameIjList, frameIkList, token));
this.setSymRepValue(this.compSymRep(this.getRepValue(), frameIkList, frameIjList, token));
}
}
}