修改bug
parent
5c9a72973e
commit
80e81f8111
|
@ -271,13 +271,17 @@ public class TaskInfoServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo> i
|
|||
}
|
||||
if (Weight.urgency.getValue().equals(weight)){
|
||||
log.info("执行紧急任务");
|
||||
// 调整线程分配以适应紧急任务
|
||||
adjustForEmergency();
|
||||
for (long i = 1; i <= count; i++) {
|
||||
long pageNum = (i - 1) * 5000;
|
||||
submitEmergencyTask(()->{
|
||||
|
||||
//getString(pageNum, finalFieName, finalJoint,basicId,newBasicId,tableId,map);
|
||||
submitEmergencyTask(()->{
|
||||
getString(pageNum, finalFieName, finalJoint,basicId,newBasicId,tableId,map);
|
||||
});
|
||||
}
|
||||
// 任务完成后恢复默认线程分配
|
||||
restoreDefaults();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ public class OptimizedPrioritizedThreadPool {
|
|||
}
|
||||
|
||||
public static void submitEmergencyTask(Runnable task) {
|
||||
// 调整线程分配以适应紧急任务
|
||||
adjustForEmergency();
|
||||
|
||||
try {
|
||||
emergencySemaphore.acquire();
|
||||
|
@ -52,8 +50,7 @@ public class OptimizedPrioritizedThreadPool {
|
|||
task.run();
|
||||
} finally {
|
||||
emergencySemaphore.release();
|
||||
// 任务完成后恢复默认线程分配
|
||||
restoreDefaults();
|
||||
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
|
@ -114,7 +111,7 @@ public class OptimizedPrioritizedThreadPool {
|
|||
}
|
||||
}
|
||||
|
||||
private static synchronized void adjustForEmergency() {
|
||||
public static synchronized void adjustForEmergency() {
|
||||
// 仅在未处于紧急模式下调整线程分配
|
||||
if (!inEmergencyMode) {
|
||||
inEmergencyMode = true;
|
||||
|
@ -129,7 +126,7 @@ public class OptimizedPrioritizedThreadPool {
|
|||
}
|
||||
}
|
||||
|
||||
private static synchronized void restoreDefaults() {
|
||||
public static synchronized void restoreDefaults() {
|
||||
// 检查是否处于紧急模式
|
||||
if (inEmergencyMode) {
|
||||
// 清空紧急任务的许可
|
||||
|
|
Loading…
Reference in New Issue