@Async
Future<String> doTaskOne() throws Exception {
System.out.println("开始做任务一");
long start = System.currentTimeMillis();
Thread.sleep(random.nextInt(10000));
long end = System.currentTimeMillis();
System.out.println("完成任务一,耗时:" + (end - start) + "毫秒");
return new AsyncResult<>("任务一OK");
}
AsyncTest.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:My-Blog
作者:
评论列表
文章目录