Class ApplicationRunner


  • public abstract class ApplicationRunner
    extends Object
    Simple application runner which authorize to reload an application.
    Since:
    2.1
    Author:
    Tony Chemit - chemit@codelutin.com
    • Field Detail

      • args

        protected final String[] args
        arguments given to runner at launch time
      • reload

        protected boolean reload
        flag to reload the runner when closing it
      • runnable

        protected final Runnable runnable
        the runner to start application
      • startingTime

        protected long startingTime
      • mainThread

        protected Thread mainThread
    • Constructor Detail

      • ApplicationRunner

        protected ApplicationRunner​(String... args)
    • Method Detail

      • unlock

        public static void unlock()
      • initOnce

        protected abstract void initOnce()
        To execute some code only once. This code will not be re-execute when reloading the runner.
      • onInit

        protected abstract void onInit()
                                throws Exception
        Hook to init runner.
        Throws:
        Exception - if any problem
      • onStart

        protected abstract void onStart()
                                 throws Exception
        Hook to start runner.
        Throws:
        Exception - if any problem
      • onClose

        protected abstract void onClose​(boolean reload)
                                 throws Exception
        Hook to close runner.
        Parameters:
        reload - if reload was asked
        Throws:
        Exception - if any problme
      • onShutdown

        protected abstract void onShutdown()
                                    throws Exception
        Hook to shutdown launcher
        Throws:
        Exception - if any problem
      • onShutdown

        protected abstract void onShutdown​(Exception ex)
        Hook to shutdown launcher when an exception occurs on clsoing.
        Parameters:
        ex - the error catched while closing launcher
      • onError

        protected abstract void onError​(Exception e)
        Hook when an error occurs in runner.
        Parameters:
        e - the error catched
      • isReload

        public boolean isReload()
      • setReload

        public void setReload​(boolean reload)
      • launch

        public final void launch()
      • close

        public final void close()