Package io.quarkus.runtime
Class ShutdownEvent
- java.lang.Object
-
- jakarta.enterprise.event.Shutdown
-
- io.quarkus.runtime.ShutdownEvent
-
public class ShutdownEvent extends jakarta.enterprise.event.Shutdown
Event that is fired before shutdown and can be inspected for shutdown cause. SeeisStandardShutdown()
This event is observed as follows:
The annotated method can access other injected beans.void onStop(@Observes ShutdownEvent ev) { LOGGER.info("The application is stopping..."); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ShutdownEvent.ShutdownReason
An enum with values reflecting the reason for application shutdown.
-
Constructor Summary
Constructors Constructor Description ShutdownEvent()
ShutdownEvent(ShutdownEvent.ShutdownReason shutdownReason)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isStandardShutdown()
Returnstrue
if the application shutdown is considered standard; i.e.
-
-
-
Constructor Detail
-
ShutdownEvent
public ShutdownEvent()
-
ShutdownEvent
public ShutdownEvent(ShutdownEvent.ShutdownReason shutdownReason)
-
-
Method Detail
-
isStandardShutdown
public boolean isStandardShutdown()
Returnstrue
if the application shutdown is considered standard; i.e. by exitingmain()
method or executing eitherQuarkus.asyncExit()
orQuarkus.blockingExit()
.All other cases are non-standard -
SIGINT
,SIGTERM
,System.exit(n
and so on. SendingCTRL + C
to running app in terminal is also non-standard shutdown.- Returns:
- true if the app shutdown was standard, false otherwise
-
-