Browse Source

REPORT-114391 【微服务适配】远程&本地设计器能够正常启动 优化启动与切换

mss/2.0
Destiny.Lin 4 months ago
parent
commit
e2443d1219
  1. 4
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  2. 8
      designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

4
designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java vendored

@ -53,6 +53,10 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo); FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo);
try { try {
LoginResponseInfoBean bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo)); LoginResponseInfoBean bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo));
// 服务器如果没返回token,肯定是出问题了,直接抛出异常
if (StringUtils.isEmpty(bean.getAccessToken())) {
throw new RuntimeException("Empty token, try connect again and check server");
}
WorkspaceConnection connection = new WorkspaceConnection( WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
connectionInfo.getUserName(), connectionInfo.getUserName(),

8
designer-realize/src/main/java/com/fanruan/boot/init/DesignPreLoadComponent.java

@ -12,6 +12,7 @@ import com.fanruan.plugin.autonomy.AutonomyClassManagerGroup;
import com.fanruan.product.BuildContext; import com.fanruan.product.BuildContext;
import com.fanruan.product.ProductConstants; import com.fanruan.product.ProductConstants;
import com.fr.base.OptimizeUtil; import com.fr.base.OptimizeUtil;
import com.fr.concurrent.FineExecutors;
import com.fr.config.dao.DaoSelectorFactory; import com.fr.config.dao.DaoSelectorFactory;
import com.fr.config.dao.PropertiesConstants; import com.fr.config.dao.PropertiesConstants;
import com.fr.decision.service.context.ServiceContext; import com.fr.decision.service.context.ServiceContext;
@ -74,6 +75,7 @@ import java.net.URLClassLoader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.Timer;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
@ -226,6 +228,12 @@ public class DesignPreLoadComponent {
try { try {
beforeAllStart(); beforeAllStart();
//清空临时文件 //清空临时文件
FineExecutors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
TmpFileUtils.cleanUpInnerTmpFiles();
}
}, 10, 10, TimeUnit.MINUTES);
Runtime.getRuntime().addShutdownHook(new Thread(TmpFileUtils::cleanUpInnerTmpFiles)); Runtime.getRuntime().addShutdownHook(new Thread(TmpFileUtils::cleanUpInnerTmpFiles));
RestartHelper.deleteRecordFilesWhenStart(); RestartHelper.deleteRecordFilesWhenStart();
CloudCenter.getInstance(); CloudCenter.getInstance();

Loading…
Cancel
Save