我有一个办法实现一下,你可以在执行时间的短的地方加一个延时。
//开始
for (int i = 0; i < fList.size(); i++) {
final List<FndMenuEntriesIntDto> sortList = fndMenuEntriesIntDao.getListByMenuId(fList.get(i).getMenuId(), versionId);
new Thread(new Runnable() {
@Override
//线程1
public void run() {
for (int i = 0; i < sortList.size(); i++) {
doSomeThing1();
Thread.sleep(3000);
}
}
}).start();
new Thread(new Runnable() {
@Override
//线程2
public void run() {
for (int i = 0; i < sortList.size(); i++) {
doSomeThing2();
}
}
}).start();
}