Skip to content

Commit 5bc493d

Browse files
kasemirshroffk
authored andcommitted
Alarm logger: First check parameters, incl. help, then start app
1 parent 55fbcbe commit 5bc493d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

services/alarm-logger/src/main/java/org/phoebus/alarm/logging/AlarmLoggingService.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,12 @@ private static boolean handleShellCommands(final String... args) throws Throwabl
7777
}
7878

7979
public static void main(final String[] original_args) throws Exception {
80-
context = SpringApplication.run(AlarmLoggingService.class, original_args);
8180
LogManager.getLogManager().readConfiguration(AlarmLoggingService.class.getResourceAsStream("/alarm_logger_logging.properties"));
8281

8382
// load the default properties
8483
final Properties properties = PropertiesHelper.getProperties();
8584

86-
// Use interactive shell by default
85+
// Use interactive shell by default
8786
boolean use_shell = true;
8887

8988
// Handle arguments
@@ -96,8 +95,7 @@ public static void main(final String[] original_args) throws Exception {
9695
if ( cmd.equals("-h") || cmd.equals("-help")) {
9796
use_shell = false;
9897
help();
99-
// Do we need the exit code for help?
100-
System.exit(SpringApplication.exit(context));
98+
System.exit(0);
10199
return;
102100
} else if (cmd.equals("-noshell")) {
103101
use_shell = false;
@@ -196,11 +194,12 @@ else if(cmd.equals("-thread_pool_size")){
196194
ex.printStackTrace();
197195
System.out.println("\n>>>> Please check available arguments of alarm-logger as follows:");
198196
help();
199-
System.exit(SpringApplication.exit(context));
197+
System.exit(-1);
200198
return;
201199
}
202200

203201
logger.info("Alarm Logging Service (PID " + ProcessHandle.current().pid() + ")");
202+
context = SpringApplication.run(AlarmLoggingService.class, original_args);
204203

205204
// Create scheduler with configured or default thread pool size
206205
Integer threadPoolSize;

0 commit comments

Comments
 (0)