==== GracefulShutdownHandler

The javadoc:GracefulShutdown[] extension allows the application to finish processing active requests before the JVM exits.

Once a shutdown is initiated, the extension interceptor ensures that all new incoming requests are rejected with a `Service Unavailable (503)` status code, while existing requests are allowed to complete within a specified grace period.

.Usage
[source, java, role = "primary"]
----
import io.jooby.GracefulShutdown;

{
  install(new GracefulShutdown()); // <1>

  get("/", ctx -> "Hello!");
}
----

.Kotlin
[source, kotlin, role = "secondary"]
----
import io.jooby.GracefulShutdown

{
  install(GracefulShutdown())      // <1>
  
  get("/") { "Hello!" }
}
----

<1> Install the `GracefulShutdown` extension.

===== Timeout

By default, the extension waits for all requests to finish. You can optionally specify a maximum duration to wait before forcing the application to stop:

[source, java]
----
install(new GracefulShutdown(Duration.ofMinutes(1)));
----

[IMPORTANT]
====
This extension must be installed at the **very beginning** of your route pipeline to ensure it can intercept and manage all incoming traffic during the shutdown phase.
====
