Package jaxx.runtime.swing.application
Class ApplicationRunner
- java.lang.Object
-
- 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 - chemit@codelutin.com
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]argsarguments given to runner at launch timeprotected Exceptionerrorprotected 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 Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()static ApplicationRunnergetRunner()protected abstract voidinitOnce()To execute some code only once.booleanisReload()voidlaunch()static voidlock()protected abstract voidonClose(boolean reload)Hook to close runner.protected abstract voidonError(Exception e)Hook when an error occurs in runner.protected abstract voidonInit()Hook to init runner.protected abstract voidonShutdown()Hook to shutdown launcherprotected abstract voidonShutdown(Exception ex)Hook to shutdown launcher when an exception occurs on clsoing.protected abstract voidonStart()Hook to start runner.voidsetReload(boolean reload)static voidunlock()
-
-
-
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
-
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()
-
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 ExceptionHook to init runner.- Throws:
Exception- if any problem
-
onStart
protected abstract void onStart() throws ExceptionHook to start runner.- Throws:
Exception- if any problem
-
onClose
protected abstract void onClose(boolean reload) throws ExceptionHook to close runner.- Parameters:
reload- if reload was asked- Throws:
Exception- if any problme
-
onShutdown
protected abstract void onShutdown() throws ExceptionHook 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()
-
-