Class Application

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public abstract class Application
    extends Object
    implements Closeable
    The application base class, which is extended and implemented by a generated class which implements the application setup logic. The base class does some basic error checking, and maintains the application state. Note that this class does not manage the application lifecycle in any way, it is solely responsible for starting and stopping the application.
    • Field Detail

      • APP_CLASS_NAME

        public static final String APP_CLASS_NAME
        The name of the generated application class
        See Also:
        Constant Field Values
    • Constructor Detail

      • Application

        protected Application​(boolean auxilaryApplication)
        Construct a new instance.
        Parameters:
        auxilaryApplication -
    • Method Detail

      • start

        public final void start​(String[] args)
        Start the application. If another thread is also trying to start the application, this method waits for that thread to finish starting. Returns immediately if the application is started already. If the application fails to start, an exception is thrown.
        Parameters:
        args - the command-line arguments
      • doStart

        protected abstract void doStart​(String[] args)
      • stop

        public final void stop()
        Stop the application. If another thread is also trying to stop the application, this method waits for that thread to finish. Returns immediately if the application is already stopped. If an exception is thrown during stop, that exception is propagated.
      • stop

        public final void stop​(Runnable afterStopTask)
        Stop the application. If another thread is also trying to stop the application, this method waits for that thread to finish. Returns immediately if the application is already stopped. If an exception is thrown during stop, that exception is propagated.
      • currentApplication

        public static Application currentApplication()
      • doStop

        protected abstract void doStop()
      • getName

        public abstract String getName()
      • awaitShutdown

        public void awaitShutdown()
      • isStarted

        public boolean isStarted()