Browse Source

REPORT-45901 【10.0.14】oem设计器多开接口 --加上端口限制

feature/big-screen
Hades 4 years ago
parent
commit
1f5f4613a1
  1. 7
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 32
      designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java
  3. 11
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

7
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -20,6 +20,7 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig; import com.fr.design.notification.SnapChatConfig;
import com.fr.design.port.DesignerPortContext;
import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
@ -844,9 +845,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* 返回Jetty服务器的端口号 * 返回Jetty服务器的端口号
*/ */
public int getEmbedServerPort() { public int getEmbedServerPort() {
DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); int embeddedServerPort = DesignerPortContext.getEmbeddedServerPort();
if (portProvider != null) { if (embeddedServerPort >= DesignerPort.MIN_PORT && embeddedServerPort <= DesignerPort.MAX_PORT) {
return portProvider.embeddedServerPort(); return embeddedServerPort;
} }
return this.jettyServerPort; return this.jettyServerPort;
} }

32
designer-base/src/main/java/com/fr/design/port/DesignerPortContext.java

@ -0,0 +1,32 @@
package com.fr.design.port;
import com.fr.design.fun.DesignerPortProvider;
import com.fr.stable.bridge.StableFactory;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/27
*/
public class DesignerPortContext {
private static int messagePort = -1;
private static int embeddedServerPort = -1;
static {
DesignerPortProvider designerPortProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class);
if (designerPortProvider != null) {
messagePort = designerPortProvider.messagePort();
embeddedServerPort = designerPortProvider.embeddedServerPort();
}
}
public static int getMessagePort() {
return messagePort;
}
public static int getEmbeddedServerPort() {
return embeddedServerPort;
}
}

11
designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.port.DesignerPortContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -36,8 +37,8 @@ import java.awt.event.ActionListener;
public class DesignerPort implements XMLReadable, XMLWriter { public class DesignerPort implements XMLReadable, XMLWriter {
public static final String XML_TAG = "DesignerPort"; public static final String XML_TAG = "DesignerPort";
private static final int MIN_PORT = 1024; public static final int MIN_PORT = 1024;
private static final int MAX_PORT = 65535; public static final int MAX_PORT = 65535;
public static final DesignerPort INSTANCE = new DesignerPort(); public static final DesignerPort INSTANCE = new DesignerPort();
@ -59,9 +60,9 @@ public class DesignerPort implements XMLReadable, XMLWriter {
private int debugMessagePort = 51463; private int debugMessagePort = 51463;
public int getMessagePort() { public int getMessagePort() {
DesignerPortProvider portProvider = StableFactory.getMarkedInstanceObjectFromClass(DesignerPortProvider.MARK_STRING, DesignerPortProvider.class); int extraMessagePort = DesignerPortContext.getMessagePort();
if (portProvider != null) { if (extraMessagePort >= MIN_PORT && extraMessagePort <= MAX_PORT) {
return portProvider.messagePort(); return extraMessagePort;
} }
return messagePort; return messagePort;
} }

Loading…
Cancel
Save