@@ -111,15 +111,29 @@ public static void main(final String[] args) {
111
111
configuration .get ().launch ();
112
112
113
113
// Wait for application shutdown
114
+ LOGGER .info ()
115
+ .setMessage ("Configurators launched, waiting for shutdown signal" )
116
+ .log ();
114
117
SHUTDOWN_SEMAPHORE .acquire ();
118
+ LOGGER .info ()
119
+ .setMessage ("Shutdown signal received, shutting down main thread" )
120
+ .log ();
115
121
} catch (final InterruptedException e ) {
116
122
throw new RuntimeException (e );
117
123
} finally {
118
124
if (configurator .isPresent ()) {
119
125
configurator .get ().shutdown ();
126
+ } else {
127
+ LOGGER .warn ()
128
+ .setMessage ("No configurator present to shut down" )
129
+ .log ();
120
130
}
121
131
if (configuration .isPresent ()) {
122
132
configuration .get ().shutdown ();
133
+ } else {
134
+ LOGGER .warn ()
135
+ .setMessage ("No running configuration present to shut down" )
136
+ .log ();
123
137
}
124
138
// Notify the shutdown that we're done
125
139
SHUTDOWN_SEMAPHORE .release ();
@@ -284,7 +298,7 @@ private static Builder<? extends JsonNodeSource> getFileSourceBuilder(
284
298
private static final Logger LOGGER = com .arpnetworking .steno .LoggerFactory .getLogger (Main .class );
285
299
private static final Duration SHUTDOWN_TIMEOUT = Duration .ofMinutes (3 );
286
300
private static final SourceTypeLiteral SOURCE_TYPE_LITERAL = new SourceTypeLiteral ();
287
- private static final Semaphore SHUTDOWN_SEMAPHORE = new Semaphore (0 );
301
+ private static final Semaphore SHUTDOWN_SEMAPHORE = new Semaphore (0 , true );
288
302
private static final Thread SHUTDOWN_THREAD = new ShutdownThread ();
289
303
private static final String HOCON_FILE_EXTENSION = ".conf" ;
290
304
0 commit comments