|
@@ -17,6 +17,10 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.SynchronousQueue;
|
|
|
+import java.util.concurrent.ThreadPoolExecutor;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
/**
|
|
|
* Created by IntelliJ IDEA.
|
|
@@ -35,6 +39,16 @@ public class SocketBufferServiceImpl implements SocketBufferService {
|
|
|
@Autowired
|
|
|
private StatusUpdateService statusUpdateService;
|
|
|
|
|
|
+ // 创建一个线程池
|
|
|
+ private static ExecutorService executorService;
|
|
|
+
|
|
|
+ static {
|
|
|
+ // 创建一个线程池
|
|
|
+ executorService = new ThreadPoolExecutor(5, 30
|
|
|
+ , 60L, TimeUnit.SECONDS
|
|
|
+ , new SynchronousQueue<Runnable>(true));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<Order> bufferSeparator(byte[] buffer) {
|
|
|
List<Order> orderList = new ArrayList<>();
|
|
@@ -137,7 +151,10 @@ public class SocketBufferServiceImpl implements SocketBufferService {
|
|
|
taskBeanUpdate.setIsDelete(null);
|
|
|
amsTaskService.updateAmsTask(taskBeanUpdate);
|
|
|
//任务状态回调
|
|
|
- statusUpdateService.updateStatus(taskBean.getId().longValue(), icarNo);
|
|
|
+ long taskId_85 = taskBean.getId().longValue();
|
|
|
+ executorService.execute(() -> {
|
|
|
+ statusUpdateService.updateStatus(taskId_85, icarNo);
|
|
|
+ });
|
|
|
break;
|
|
|
case 86://user event Order Receive 任务开始
|
|
|
case 87://user event FETCH(LP1) is Invalid!!
|
|
@@ -162,7 +179,10 @@ public class SocketBufferServiceImpl implements SocketBufferService {
|
|
|
taskBeanUpdate01.setIsDelete(null);
|
|
|
amsTaskService.updateAmsTask(taskBeanUpdate01);
|
|
|
|
|
|
- statusUpdateService.updateStatus(taskBean.getId().longValue(), icarNo);
|
|
|
+ long taskId = taskBean.getId().longValue();
|
|
|
+ executorService.execute(() -> {
|
|
|
+ statusUpdateService.updateStatus(taskId, icarNo);
|
|
|
+ });
|
|
|
}
|
|
|
break;
|
|
|
case 112://user event Carrier status
|