fix:线程阻塞

This commit is contained in:
2024-08-22 11:02:47 +08:00
parent ee2b8cf250
commit 3363a5ecb9
2 changed files with 7 additions and 10 deletions

View File

@@ -260,22 +260,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
});
}
//申请空托盘出库
// if (mode == 8 && !requireSucess) {
if (true) {
List list = new ArrayList<>();
Map map = new HashMap<>();
map.put("code", "to_target");
map.put("value", "0");
list.add(map);
this.writing(list);
if (mode == 8 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
}
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";

View File

@@ -3,6 +3,8 @@ package org.nl.acs.opc;
import lombok.extern.slf4j.Slf4j;
import org.dromara.dynamictp.core.DtpRegistry;
import org.dromara.dynamictp.core.executor.DtpExecutor;
import org.dromara.dynamictp.core.executor.OrderedDtpExecutor;
import org.dromara.dynamictp.core.executor.eager.EagerDtpExecutor;
import org.dromara.dynamictp.core.support.ExecutorWrapper;
import org.nl.acs.auto.run.AbstractAutoRunnable;
import org.nl.acs.auto.run.AutoRunService;
@@ -134,8 +136,11 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
ScheduledExecutorService scheduler = (ScheduledExecutorService) DtpRegistry.getExecutor("scheduled_pool");
EagerDtpExecutor eagerDtpExecutor = (EagerDtpExecutor) DtpRegistry.getExecutor("scheduled_pool");
OrderedDtpExecutor orderedDtpExecutor = (OrderedDtpExecutor) DtpRegistry.getExecutor("scheduled_pool");
// 使用调度器在超时后取消任务
scheduler.schedule(() -> {
//异步任务没有结束
if (!future.isDone()) {
try {
future.get(5, TimeUnit.SECONDS);
@@ -143,7 +148,6 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
future.cancel(true);
}
}
}, 1, TimeUnit.MILLISECONDS); // 设置超时时间为10秒
}
}