private void setupPendingResponsesMetrics() {
            final GracefulShutdownSupport gracefulShutdownSupport = this.gracefulShutdownSupport;
            assert gracefulShutdownSupport != null;

            // Move to ServerMetrics.
            config.meterRegistry().gauge("armeria.server.pending.responses", gracefulShutdownSupport,
                                         GracefulShutdownSupport::pendingResponses);
        }
Registers a JVM shutdown hook that closes this {@link Server} when the current JVM terminates.

@param whenClosing the {@link Runnable} will be run before closing this {@link Server}
core/src/main/java/com/linecorp/armeria/server/Server.java