Skip to content

Commit 5d57d5f

Browse files
authored
Merge pull request #2597 from lcaouen/AlarmServerExportStabilization
services-alarm-server : increase STABILIZATION_SECS when exporting #2596
2 parents 5a03004 + 7bb48ba commit 5d57d5f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

services/alarm-server/src/main/java/org/phoebus/applications/alarm/server/AlarmConfigTool.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
public class AlarmConfigTool
3030
{
3131
/** Time the model must be stable for. Unit is seconds. Default is 4 seconds. */
32-
private static final long STABILIZATION_SECS = 4;
32+
private long STABILIZATION_SECS = 4;
3333

3434
// Export an alarm system model to an xml file.
35-
public void exportModel(String filename, String server, String config, String kafka_properties_file) throws Exception
35+
public void exportModel(String filename, String server, String config, String kafka_properties_file, long wait) throws Exception
3636
{
3737
final XmlModelWriter xmlWriter;
3838

39+
if (wait > STABILIZATION_SECS) STABILIZATION_SECS = wait;
40+
3941
// Write to stdout or to file.
4042
if (filename.equals("stdout"))
4143
xmlWriter = new XmlModelWriter(System.out);

services/alarm-server/src/main/java/org/phoebus/applications/alarm/server/AlarmServerMain.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ public static void main(final String[] original_args) throws Exception
571571
String settings_arg = "-settings";
572572
String noshell_arg = "-noshell";
573573
String export_arg = "-export";
574+
String export_wait_arg = "-export_wait";
574575
String import_arg = "-import";
575576
String logging_arg = "-logging";
576577
String kafka_props_arg = "-kafka_properties";
@@ -580,6 +581,7 @@ public static void main(final String[] original_args) throws Exception
580581
config_arg,
581582
settings_arg,
582583
export_arg,
584+
export_wait_arg,
583585
import_arg,
584586
logging_arg,
585587
kafka_props_arg);
@@ -596,6 +598,7 @@ public static void main(final String[] original_args) throws Exception
596598
Map<String, String> args_to_prefs = Map.ofEntries(
597599
Map.entry(config_arg, "config_names"),
598600
Map.entry(server_arg, "server"),
601+
Map.entry(export_wait_arg, "export_wait"),
599602
Map.entry(kafka_props_arg, "kafka_properties")
600603
);
601604

@@ -658,8 +661,11 @@ else if (Set.of(userPrefs.keys()).contains(prefKey)){
658661
}
659662
if (parsed_args.containsKey(export_arg)){
660663
final String filename = parsed_args.get(export_arg);
664+
final String waitArg = parsed_args.get(export_wait_arg);
665+
final long wait = (waitArg != null && !waitArg.equals("")) ? Long.parseLong(waitArg) : 0;
661666
logger.info("Exporting model to " + filename);
662-
new AlarmConfigTool().exportModel(filename, server, config, kafka_properties);
667+
logger.info("wait " + wait);
668+
new AlarmConfigTool().exportModel(filename, server, config, kafka_properties, wait);
663669
}
664670
if (parsed_args.containsKey(import_arg)){
665671
final String filename = parsed_args.get(import_arg);

0 commit comments

Comments
 (0)