Browse Source

Pull request #9454: KERNEL-11853 抽数缓存最小更新间隔限制1分钟

Merge in DESIGN/design from ~MAXIMUS/design:release/11.0 to release/11.0

* commit '90fc5542b3b830ce2fe7d7faa22322ed284f5e75':
  KERNEL-11853 设置的分钟数可以支持小数,但不能小于1分钟
release/11.0
Maximus 2 years ago
parent
commit
6945cc247e
  1. 13
      designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java

13
designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java

@ -133,7 +133,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
ob = StrategyConfigHelper.createStrategyConfig(true, false, true); ob = StrategyConfigHelper.createStrategyConfig(true, false, true);
} }
this.strategyConfig = ob; this.strategyConfig = ob;
this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.format("%.0f", ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.valueOf(ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE));
this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0]))); this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0])));
this.shouldEvolve.setSelected(ob.shouldEvolve()); this.shouldEvolve.setSelected(ob.shouldEvolve());
this.selectBySchema.setSelected(ob.isScheduleBySchema()); this.selectBySchema.setSelected(ob.isScheduleBySchema());
@ -185,7 +185,6 @@ public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
this.schemaTimeCheckTips.setVisible(true); this.schemaTimeCheckTips.setVisible(true);
throw new IllegalArgumentException("[ESD]Update schema time interval is to short."); throw new IllegalArgumentException("[ESD]Update schema time interval is to short.");
} }
} else { } else {
Collections.addAll(schemaTimes, text.split(",")); Collections.addAll(schemaTimes, text.split(","));
} }
@ -200,8 +199,15 @@ public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
String interval = this.updateInterval.getText(); String interval = this.updateInterval.getText();
if (checkUpdateInterval(interval)) { if (checkUpdateInterval(interval)) {
long intervalMillis = StringUtils.isEmpty(interval) ? 0 : (long) (Double.parseDouble(interval) * CacheConstants.MILLIS_OF_MINUTE); long intervalMillis = StringUtils.isEmpty(interval) ? 0 : (long) (Double.parseDouble(interval) * CacheConstants.MILLIS_OF_MINUTE);
if (intervalMillis >= CacheConstants.MILLIS_OF_MINUTE) {
config.setUpdateInterval(intervalMillis); config.setUpdateInterval(intervalMillis);
} else { } else {
this.updateIntervalCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Interval_Too_Short"));
this.updateIntervalCheckTips.setVisible(true);
throw new IllegalArgumentException("[ESD]Update schema time interval is to short.");
}
} else {
this.updateIntervalCheckTips.setText(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format"));
this.updateIntervalCheckTips.setVisible(true); this.updateIntervalCheckTips.setVisible(true);
throw new IllegalArgumentException("[ESD]Error update interval format."); throw new IllegalArgumentException("[ESD]Error update interval format.");
} }
@ -220,7 +226,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
private boolean checkUpdateInterval(String intervalValue) { private boolean checkUpdateInterval(String intervalValue) {
try { try {
return !StringUtils.isEmpty(intervalValue) && !(Integer.parseInt(intervalValue) <= 0); return !StringUtils.isEmpty(intervalValue) && !(Double.parseDouble(intervalValue) <= 0);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -228,6 +234,7 @@ public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
return false; return false;
} }
private boolean checkCornTimeInterval (String cronText) { private boolean checkCornTimeInterval (String cronText) {
// 判断后两次更新时间间隔,如果小于1分钟就返回false // 判断后两次更新时间间隔,如果小于1分钟就返回false
try { try {

Loading…
Cancel
Save