Class ApplicationRunner
- java.lang.Object
-
- org.nuiton.jaxx.runtime.swing.application.ApplicationRunner
-
public abstract class ApplicationRunner extends Object
Simple application runner which authorize to reload an application.- Since:
- 2.1
- Author:
- Tony Chemit - dev@tchemit.fr
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]argsarguments given to runner at launch timeprotected Exceptionerrorprotected booleaninitOnceflag to know if application was init once.protected ThreadmainThreadprotected booleanreloadflag to reload the runner when closing itprotected Runnablerunnablethe runner to start applicationprotected longstartingTime
-
Constructor Summary
Constructors Modifier Constructor Description protectedApplicationRunner(String... args)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()String[]getArgs()static ApplicationRunnergetRunner()voidinitOnce()To execute some code only once.booleanisReload()voidlaunch()static voidlock()voidonClose(boolean reload)Hook to close runner.voidonError(Exception e)Hook when an error occurs in runner.voidonInit()Hook to init runner.voidonShutdown()Hook to shutdown launchervoidonShutdown(Exception ex)Hook to shutdown launcher when an exception occurs on closing.voidonStart()Hook to start runner.voidsetMainListener(ApplicationRunnerListener mainListener)voidsetReload(boolean reload)static voidunlock()
-
-
-
Field Detail
-
args
protected final String[] args
arguments given to runner at launch time
-
runnable
protected final Runnable runnable
the runner to start application
-
reload
protected boolean reload
flag to reload the runner when closing it
-
initOnce
protected boolean initOnce
flag to know if application was init once.
-
startingTime
protected long startingTime
-
error
protected Exception error
-
mainThread
protected Thread mainThread
-
-
Constructor Detail
-
ApplicationRunner
protected ApplicationRunner(String... args)
-
-
Method Detail
-
getRunner
public static ApplicationRunner getRunner()
-
lock
public static void lock() throws InterruptedException- Throws:
InterruptedException
-
unlock
public static void unlock()
-
setMainListener
public void setMainListener(ApplicationRunnerListener mainListener)
-
launch
public final void launch()
-
initOnce
public void initOnce()
To execute some code only once.This code will not be re-execute when reloading the runner.
-
onInit
public void onInit() throws ExceptionHook to init runner.- Throws:
Exception- if any problem
-
onStart
public void onStart() throws ExceptionHook to start runner.- Throws:
Exception- if any problem
-
onClose
public void onClose(boolean reload) throws ExceptionHook to close runner.- Parameters:
reload- if reload was asked- Throws:
Exception- if any problem
-
onShutdown
public void onShutdown() throws ExceptionHook to shutdown launcher- Throws:
Exception- if any problem
-
onShutdown
public void onShutdown(Exception ex)
Hook to shutdown launcher when an exception occurs on closing.- Parameters:
ex- the error catch while closing launcher
-
onError
public void onError(Exception e)
Hook when an error occurs in runner.- Parameters:
e- the error catch
-
isReload
public boolean isReload()
-
setReload
public void setReload(boolean reload)
-
getArgs
public String[] getArgs()
-
close
public final void close()
-
-