Class QApplicationLauncher

java.lang.Object
com.kingsrook.qqq.middleware.javalin.QApplicationLauncher

public class QApplicationLauncher extends Object
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 Details

  • 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

      public List<String> getStartedServiceNames()
      Names of what's running, in the order it was started.
    • getQInstance

      public QInstance getQInstance()
      Getter for the QInstance the server built, which the schedule manager and runtime services were started with.
    • getServer

      public QApplicationJavalinServer getServer()
      Getter for the javalin server