shutDownHookAction

fun shutDownHookAction(service: Service): Thread

Creates a JVM shutdown hook Thread that gracefully stops the given Service.

The thread logs at INFO when it begins stopping the service and when the service has stopped. JVM shutdown hooks run concurrently, so a logging framework that stops itself in a hook of its own can drop these lines.

Return

A Thread suitable for use with Runtime.addShutdownHook.

Parameters

service

The Guava Service to stop when the JVM shuts down.