From 8cefc269417c56c19c0e7a27ae02d584396fb3a5 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 13 三月 2025 12:46:20 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/ServerBootstrap.java | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/zy/core/ServerBootstrap.java b/src/main/java/com/zy/core/ServerBootstrap.java
index bab666b..5420fbd 100644
--- a/src/main/java/com/zy/core/ServerBootstrap.java
+++ b/src/main/java/com/zy/core/ServerBootstrap.java
@@ -1,5 +1,6 @@
package com.zy.core;
+import com.core.exception.CoolException;
import com.zy.common.utils.RedisUtil;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
@@ -61,16 +62,29 @@
// 鍒濆鍖栬揣鍙夋彁鍗囨満
News.info("鍒濆鍖栬揣鍙夋彁鍗囨満........................................................");
for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) {
- ZyForkLiftThread forkLiftThread = new ZyForkLiftThread(forkLiftSlave, redisUtil);
- new Thread(forkLiftThread).start();
- SlaveConnection.put(SlaveType.ForkLift, forkLiftSlave.getId(), forkLiftThread);
+ ThreadHandler thread = null;
+ if (forkLiftSlave.getThreadImpl().equals("ZyForkLiftThread")) {
+ thread = new ZyForkLiftThread(forkLiftSlave, redisUtil);
+ } else {
+ throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
+ }
+
+ new Thread(thread).start();
+ SlaveConnection.put(SlaveType.ForkLift, forkLiftSlave.getId(), thread);
}
+
// 鍒濆鍖栧洓鍚戠┛姊溅
News.info("鍒濆鍖栧洓鍚戠┛姊溅......................................................");
for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
- NyShuttleThread shuttleThread = new NyShuttleThread(shuttleSlave,redisUtil);
- new Thread(shuttleThread).start();
- SlaveConnection.put(SlaveType.Shuttle, shuttleSlave.getId(), shuttleThread);
+ ThreadHandler thread = null;
+ if (shuttleSlave.getThreadImpl().equals("NyShuttleThread")) {
+ thread = new NyShuttleThread(shuttleSlave, redisUtil);
+ } else {
+ throw new CoolException("鏈煡鐨勭嚎绋嬪疄鐜�");
+ }
+
+ new Thread(thread).start();
+ SlaveConnection.put(SlaveType.Shuttle, shuttleSlave.getId(), thread);
}
}
--
Gitblit v1.9.1