Hook for lifecycle "stop"?

1,555 views
Skip to first unread message

Nick Telford

unread,
Jan 13, 2012, 2:05:50 PM1/13/12
to dropwiz...@googlegroups.com
Hi Coda,

Firstly - Dropwizard looks excellent, exactly the sort of glue I've been looking for. Thanks for sharing it with the world.

I'm looking to integrate a DW project in to the Apache Commons Daemon process container (jsvc) and I was wondering if there are any "stop" hooks that can be used to gracefully shutdown the process?

I had a look through the code and it appears as if the Command abstraction causes the lifecycle to be encapsulated in a ServerCommand and thus unavailable from the initializing context.

Regards,

Nick Telford

Coda Hale

unread,
Jan 13, 2012, 3:10:23 PM1/13/12
to dropwiz...@googlegroups.com
Check out Managed and Environment#manage().

--
Coda Hale
http://codahale.com

Nick Telford

unread,
Jan 13, 2012, 3:29:18 PM1/13/12
to dropwiz...@googlegroups.com
These appear to register a Managed object for the Jetty LifeCycle to manage. Is there a facility to invert this - so an external object can manage the lifecycle of the Environment?

Specifically, I'm looking for a way to externally "stop" the Environment - aside from just sending the process SIGINT.

Coda Hale

unread,
Jan 13, 2012, 6:29:55 PM1/13/12
to dropwiz...@googlegroups.com
Ah, I see what you mean. No, there currently isn't.

I'll give it some thought, or if you come up with something you can send me a pull request.

Christophe Furmaniak

unread,
Jul 1, 2012, 4:48:12 AM7/1/12
to dropwiz...@googlegroups.com
I don't think this hook has been provided.

Maybe providing a mechanism that works like jetty start.jar Monitor class  could be interesting? (see https://github.com/eclipse/jetty.project/blob/master/jetty-start/src/main/java/org/eclipse/jetty/start/Monitor.java)

snoopy woodstock

unread,
Nov 24, 2012, 1:03:33 AM11/24/12
to dropwiz...@googlegroups.com
https://github.com/codahale/dropwizard/pull/220

Hopefully, the pull request will be accepted, or re-worked to make it available.

snoopy woodstock

unread,
Nov 24, 2012, 1:04:26 AM11/24/12
to dropwiz...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages