美文网首页
Future使用原则

Future使用原则

作者: 泓礼 | 来源:发表于2018-12-28 12:14 被阅读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

});

相关文章

网友评论

      本文标题:Future使用原则

      本文链接:https://www.haomeiwen.com/subject/vpeslqtx.html