public void execute2(){
for (int j = 0; j >= 10; j--) {
forkJoinPool.addTask(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
//而外起的线程,带事务的方法(事务超时中断....forkJoinPool.execute()超时中断)
return createTemplateFile(currentVersion, lastVersionNo);
}
});
//单线程没问题,还是execute方法的事物
//createTemplateFile(currentVersion, lastVersionNo);
}
//阻塞等待所有任务执行完成
forkJoinPool.execute();
}
//带事物的方法
public void execute(){
execute2();
}
线程池超时异常 博客分类: 异常
转载于:https://my.oschina.net/xiaominmin/blog/1599258