File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
jooby-run/src/main/java/org/jooby/run
jooby/src/main/java/org/jooby Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -235,7 +235,14 @@ private void startApp(final List<String> args) {
235235 Method joobyRun = app .getClass ().getMethod ("start" , String [].class );
236236 Object p = args .toArray (new String [args .size ()]);
237237 joobyRun .invoke (this .app , p );
238- debug ("started: %s" , mainClass );
238+ Method started = app .getClass ().getMethod ("isStarted" );
239+ Boolean success = (Boolean ) started .invoke (this .app );
240+ if (success ) {
241+ debug ("started: %s" , mainClass );
242+ } else {
243+ debug ("not started: %s" , mainClass );
244+ System .exit (1 );
245+ }
239246 } catch (Throwable ex ) {
240247 Throwable cause = ex ;
241248 if (ex instanceof InvocationTargetException ) {
Original file line number Diff line number Diff line change @@ -4160,7 +4160,7 @@ private Injector bootstrap(final Config args,
41604160 throw new IllegalStateException ("Required property 'application.secret' is missing" );
41614161 }
41624162
4163- /** executors .*/
4163+ /** executors . */
41644164 if (executors .isEmpty ()) {
41654165 // default executor
41664166 executor (MoreExecutors .newDirectExecutorService ());
@@ -4456,6 +4456,15 @@ public void stop() {
44564456 stop (Optional .empty ());
44574457 }
44584458
4459+ /**
4460+ * Test if the application is up and running.
4461+ *
4462+ * @return True if the application is up and running.
4463+ */
4464+ public boolean isStarted () {
4465+ return started .get ();
4466+ }
4467+
44594468 private void stop (final Optional <Throwable > x ) {
44604469 if (started .compareAndSet (true , false )) {
44614470 Logger log = logger (this );
You can’t perform that action at this time.
0 commit comments