private static final ExecutorService threadPool= Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
public void method(String str) {
......
if ([退出循环的条件]) {
threadPool.execute(() -> {
method(str)
});
} else {
return;
}
}
方法递归调用,如何提前将方法完成,方便内存回收——开新线程
猜你喜欢
转载自blog.csdn.net/weixin_42152023/article/details/83037237
今日推荐
周排行