Browse Source

REPORT-22779 更新升级后重启失败

feature/big-screen
pengda 5 years ago
parent
commit
5220af6b83
  1. 44
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  2. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

44
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -33,7 +33,7 @@ public class RestartHelper {
public static final String RECORD_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "delete.properties");
public static final String MOVE_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "move.properties");
private static OSBasedAction restartAction;
/**
* 把要删除的文件都记录到delete.properties中
@ -171,8 +171,8 @@ public class RestartHelper {
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class);
osBasedAction.execute(filesToBeDelete);
restartAction.execute(filesToBeDelete);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
@ -187,39 +187,11 @@ public class RestartHelper {
}
}
/* private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add("open");
commands.add(installHome + File.separator + "bin" + File.separator + "restart.app");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add("--args");
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
private static void restartInWindows(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add(installHome + File.separator + "bin" + File.separator + "restart.exe");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
/**
* 提前初始化重启动作
*/
public static void initRestartAction(){
restartAction = OSSupportCenter.getAction(RestartAction.class);
}
private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
//现在先写的是restart.sh
commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}*/
}

2
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -11,6 +11,7 @@ import com.fr.config.MarketConfig;
import com.fr.decision.update.backup.RecoverManager;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.RestartHelper;
import com.fr.design.actions.NewFormAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction;
@ -139,6 +140,7 @@ public class DesignerActivator extends Activator {
storePassport();
AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner());
RestartHelper.initRestartAction();
}
@Override

Loading…
Cancel
Save