Future使用原则

2018-12-28  本文已影响0人  泓礼

1. 异常处理

whenComplete((result,ex)-> {

if(null != ex) {

// must do exception handle

}

}

whenCompleteAsync(

// some async call 

fun1();

).exceptionally(ex-> {

// must do this if fun1 doesn't has error handling

});

上一篇 下一篇

猜你喜欢

热点阅读