Class QApplicationLauncher
java.lang.Object
com.kingsrook.qqq.middleware.javalin.QApplicationLauncher
One entry point that starts everything an application has configured, in
this order:
- its QApplicationJavalinServer (which builds the application's QInstance);
- the QScheduleManager, when that instance has anything scheduled (or the
scheduledJob table);
- each of the instance's runtime services (QInstance.withRuntimeService).
All of them use the one QInstance the server built.
stop (and, unless turned off in the config, a JVM shutdown hook) stops them
in reverse order. If anything fails to start (including a LinkageError,
e.g., from a library missing from the classpath), the ones already started
are stopped, and run throws.
e.g., in a main method:
QApplicationLauncher.run(new MyApplication(), new QApplicationLauncherConfig()
.withServerCustomizer(server -> server.withPort(8080))
.withFailOnMetaDataProducerError(true));
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionGetter for the QInstance the server built, which the schedule manager and runtime services were started with.Getter for the javalin serverNames of what's running, in the order it was started.static QApplicationLauncherrun(AbstractQQQApplication application, QApplicationLauncherConfig config) Start the application's server, schedule manager, and runtime services, returning the launcher that can stop them.voidstop()Stop everything the launcher started, in reverse order.
-
Field Details
-
JAVALIN_SERVER_SERVICE_NAME
- See Also:
-
SCHEDULE_MANAGER_SERVICE_NAME
- See Also:
-
-
Method Details
-
run
public static QApplicationLauncher run(AbstractQQQApplication application, QApplicationLauncherConfig config) throws QException Start the application's server, schedule manager, and runtime services, returning the launcher that can stop them. A null config means the defaults.- Throws:
QException
-
stop
public void stop()Stop everything the launcher started, in reverse order. An error stopping one is logged, and the rest are still stopped. Then run runtime services' final application cleanup in reverse order, isolating failures there too. Reentrant calls on the stopping thread do nothing; concurrent callers wait. Calling it again after completion does nothing. -
getStartedServiceNames
-
getQInstance
Getter for the QInstance the server built, which the schedule manager and runtime services were started with. -
getServer
Getter for the javalin server
-