Package io.quarkus.runtime
Class Application
- java.lang.Object
-
- io.quarkus.runtime.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 Summary
Fields Modifier and Type Field Description static StringAPP_CLASS_NAMEThe name of the generated application classprotected static ApplicationcurrentApplication
-
Constructor Summary
Constructors Modifier Constructor Description protectedApplication(boolean auxiliaryApplication)Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidawaitShutdown()voidclose()static ApplicationcurrentApplication()protected abstract voiddoStart(String[] args)protected abstract voiddoStop()abstract StringgetName()booleanisStarted()voidstart(String[] args)Start the application.voidstop()Stop the application.voidstop(Runnable afterStopTask)Stop 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
-
currentApplication
protected static volatile Application currentApplication
-
-
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)
-
close
public final void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
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()
-
-