user3732793
user3732793

Reputation: 1959

DebugHandler Depricated in latest Jetty Version, how to properly shutdown?

Example of how to enable an shutdownhandler for Embedded Jetty

when I try to use it with a newer Jetty Version I get deprecated warnings.

What would be the proper way to Implement a shutdown handler for the latest Jetty version ?

[Edit]

tried to add shutdown functionality with. ShutdownHandler shutdownHandler = new ShutdownHandler("switchoff", true, true);

but got 404 with http://localhost:22279/shutdown?token="switchoff"

Welcome Page does work with http://localhost:22279/

Upvotes: 0

Views: 217

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49462

DebugHandler is not necessary for shutdown.

If you are using embedded jetty, you can just keep a reference to the Server object and call Server.stop() when you want it to shut down.

otherwise ...

The ShutdownHandler can still be used, it has not been disabled or deprecated.

org/eclipse/jetty/server/handler/ShutdownHandler.java

The javadoc even has a snippet that shows its use.

API Docs: org.eclipse.jetty.server.handler.ShutdownHandler

Upvotes: 1

Related Questions