异步方法@Async

使用例子

 

class testAsync{

  @Async   
public Future<String> doTest() throws Exception {   //TODO

  return new AsyncResult<>("返回信息");   }
}

判断是否执行完成

t = new testAsync

Future<String> test = t.doTest();
test.isDone();

 

posted @ 2021-12-28 15:46  jason47  阅读(28)  评论(0编辑  收藏  举报