public abstract class ApplicationRunner extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String[] |
args
arguments given to runner at launch time
|
protected Exception |
error |
protected boolean |
initOnce
flag to know if application was init once.
|
protected Thread |
mainThread |
protected boolean |
reload
flag to reload the runner when closing it
|
protected Runnable |
runnable
the runner to start application
|
protected long |
startingTime |
| Modifier | Constructor and Description |
|---|---|
protected |
ApplicationRunner(String... args) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String[] |
getArgs() |
static ApplicationRunner |
getRunner() |
void |
initOnce()
To execute some code only once.
|
boolean |
isReload() |
void |
launch() |
static void |
lock() |
void |
onClose(boolean reload)
Hook to close runner.
|
void |
onError(Exception e)
Hook when an error occurs in runner.
|
void |
onInit()
Hook to init runner.
|
void |
onShutdown()
Hook to shutdown launcher
|
void |
onShutdown(Exception ex)
Hook to shutdown launcher when an exception occurs on closing.
|
void |
onStart()
Hook to start runner.
|
void |
setMainListener(ApplicationRunnerListener mainListener) |
void |
setReload(boolean reload) |
static void |
unlock() |
protected final String[] args
protected final Runnable runnable
protected boolean reload
protected boolean initOnce
protected long startingTime
protected Exception error
protected Thread mainThread
protected ApplicationRunner(String... args)
public static ApplicationRunner getRunner()
public static void lock()
throws InterruptedException
InterruptedExceptionpublic static void unlock()
public void setMainListener(ApplicationRunnerListener mainListener)
public final void launch()
public void initOnce()
This code will not be re-execute when reloading the runner.
public void onInit()
throws Exception
Exception - if any problempublic void onStart()
throws Exception
Exception - if any problempublic void onClose(boolean reload)
throws Exception
reload - if reload was askedException - if any problempublic void onShutdown()
throws Exception
Exception - if any problempublic void onShutdown(Exception ex)
ex - the error catch while closing launcherpublic void onError(Exception e)
e - the error catchpublic boolean isReload()
public void setReload(boolean reload)
public String[] getArgs()
public final void close()
Copyright © 2008–2020 Ultreia.io. All rights reserved.