我正在使用javanica,并通过注释@HystrixCommand
定义我的Hstrix命令。
Hystrix命令返回一个AsyncResult(Future),但是我正在寻找一种方法,等待所有命令完成,以防在同一命令上进行迭代。
最好的方法是什么?
是否有任何涉及ExecutorCompletionService
的方式?
//just an example
@HystrixCommand
public Future<List<String>> find(String str) {
return new AsyncResult<List<String>>() {
@Override
public List<String> invoke() {
return str + " test";
}
};
}