From 98d120bd0633e4e0717d584cae5514132a18516b Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期四, 18 十二月 2025 13:36:09 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java | 51 +++++++++++++++++++++++++++------------------------
1 files changed, 27 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java b/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java
index 4737144..570b9aa 100644
--- a/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java
+++ b/src/main/java/com/zy/core/network/fake/ZyCrnFakeConnect.java
@@ -29,6 +29,7 @@
@Override
public boolean disconnect() {
+ try { executor.shutdownNow(); } catch (Exception ignore) {}
return true;
}
@@ -89,10 +90,9 @@
moveY(this.crnStatus.getBay(), sourcePosY);
moveZ(this.crnStatus.getLevel(), sourcePosZ);
this.crnStatus.setStatus(CrnStatusType.FETCHING.id);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(2000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
this.crnStatus.setLoaded(1);
@@ -100,10 +100,9 @@
moveY(this.crnStatus.getBay(), destinationPosY);
moveZ(this.crnStatus.getLevel(), destinationPosZ);
this.crnStatus.setStatus(CrnStatusType.PUTTING.id);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(2000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
this.crnStatus.setLoaded(0);
this.crnStatus.setStatus(CrnStatusType.WAITING.id);
@@ -116,10 +115,9 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosZ++;
this.crnStatus.setLevel(initSourcePosZ);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}else {
@@ -128,10 +126,9 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosZ--;
this.crnStatus.setLevel(initSourcePosZ);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}
@@ -144,10 +141,9 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosY++;
this.crnStatus.setBay(initSourcePosY);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}else {
@@ -156,12 +152,19 @@
for(int i = 0; i < moveLength; i++) {
initSourcePosY--;
this.crnStatus.setBay(initSourcePosY);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
+ sleep(1000);
+ if (Thread.currentThread().isInterrupted()) {
+ return;
}
}
}
}
+
+ private void sleep(long ms) {
+ try {
+ Thread.sleep(ms);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
}
--
Gitblit v1.9.1