Package io.micronaut.runtime.graceful
Class GracefulShutdownListener
java.lang.Object
io.micronaut.runtime.graceful.GracefulShutdownListener
- All Implemented Interfaces:
ApplicationEventListener<ShutdownEvent>
,Ordered
,EventListener
@Singleton
@Requires(bean=GracefulShutdownManager.class) @Requires(property="micronaut.lifecycle.graceful-shutdown.enabled",value="true",defaultValue="false")
public final class GracefulShutdownListener
extends Object
implements ApplicationEventListener<ShutdownEvent>, Ordered
Listener that intercepts
ShutdownEvent
to initiate and wait for a graceful shutdown, if
configured.- Since:
- 4.9.0
- Author:
- Jonas Konrad
-
Field Summary
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescriptionint
getOrder()
void
onApplicationEvent
(ShutdownEvent event) Handle an application event.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.context.event.ApplicationEventListener
supports
-
Method Details
-
onApplicationEvent
Description copied from interface:ApplicationEventListener
Handle an application event.- Specified by:
onApplicationEvent
in interfaceApplicationEventListener<ShutdownEvent>
- Parameters:
event
- the event to respond to
-
getOrder
public int getOrder()
-