fix:线程阻塞
This commit is contained in:
@@ -260,22 +260,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
//申请空托盘出库
|
//申请空托盘出库
|
||||||
// if (mode == 8 && !requireSucess) {
|
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 (container_type == 0) {
|
if (container_type == 0) {
|
||||||
message = "托盘类型为空";
|
message = "托盘类型为空";
|
||||||
} else {
|
} else {
|
||||||
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
|
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
this.setIsonline(false);
|
this.setIsonline(false);
|
||||||
message = "脱机";
|
message = "脱机";
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package org.nl.acs.opc;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.dynamictp.core.DtpRegistry;
|
import org.dromara.dynamictp.core.DtpRegistry;
|
||||||
import org.dromara.dynamictp.core.executor.DtpExecutor;
|
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.dromara.dynamictp.core.support.ExecutorWrapper;
|
||||||
import org.nl.acs.auto.run.AbstractAutoRunnable;
|
import org.nl.acs.auto.run.AbstractAutoRunnable;
|
||||||
import org.nl.acs.auto.run.AutoRunService;
|
import org.nl.acs.auto.run.AutoRunService;
|
||||||
@@ -134,8 +136,11 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
|
|||||||
|
|
||||||
|
|
||||||
ScheduledExecutorService scheduler = (ScheduledExecutorService) DtpRegistry.getExecutor("scheduled_pool");
|
ScheduledExecutorService scheduler = (ScheduledExecutorService) DtpRegistry.getExecutor("scheduled_pool");
|
||||||
|
EagerDtpExecutor eagerDtpExecutor = (EagerDtpExecutor) DtpRegistry.getExecutor("scheduled_pool");
|
||||||
|
OrderedDtpExecutor orderedDtpExecutor = (OrderedDtpExecutor) DtpRegistry.getExecutor("scheduled_pool");
|
||||||
// 使用调度器在超时后取消任务
|
// 使用调度器在超时后取消任务
|
||||||
scheduler.schedule(() -> {
|
scheduler.schedule(() -> {
|
||||||
|
//异步任务没有结束
|
||||||
if (!future.isDone()) {
|
if (!future.isDone()) {
|
||||||
try {
|
try {
|
||||||
future.get(5, TimeUnit.SECONDS);
|
future.get(5, TimeUnit.SECONDS);
|
||||||
@@ -143,7 +148,6 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
|
|||||||
future.cancel(true);
|
future.cancel(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 1, TimeUnit.MILLISECONDS); // 设置超时时间为10秒
|
}, 1, TimeUnit.MILLISECONDS); // 设置超时时间为10秒
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user