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 String
APP_CLASS_NAME
The name of the generated application class
-
Constructor Summary
Constructors Modifier Constructor Description protected
Application(boolean auxilaryApplication)
Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
awaitShutdown()
void
close()
static Application
currentApplication()
protected abstract void
doStart(String[] args)
protected abstract void
doStop()
abstract String
getName()
boolean
isStarted()
void
start(String[] args)
Start the application.void
stop()
Stop the application.void
stop(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
-
-
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:
close
in interfaceAutoCloseable
- Specified by:
close
in 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()
-
-