Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Graceful shutdown for custom connections


Josh,

it is a little different in Jetty-9 vs jetty-10, but we may backport 10 changes to 9, so I will describe those.

Typically a connector does not track requests, so it is not the connector that waits for requests to drain, but the StatsHandler instead.

Any object in the component tree (the addBean, addHandler etc. on ContainerLifeCycle that is the server and it's handlers) may implement the Graceful interface and it will be called to obtain a Future that will be completed once it has gracefully shutdown.

Some components just switch to a different mode - ie responses are now sent with Connection:close so connections are not persistent, whilst others take time: eg statshandler waits for dispatched request count to go to zero

So you may need nothing more than to deploy the statshandler.  But if you have special stuff in your connector, then implement Graceful and you should be called.

cheers













On Wed, 6 Jan 2021 at 01:27, Josh Spiegel <joshlakewg@xxxxxxxxx> wrote:
Hi,

I've implemented a custom ConnectionFactory and Connection for a custom protocol (not http).  I've been using them with Server and ServerConnector.  I'd like to hook my connections into the Graceful shutdown process that is already in place.  i.e. I'd like to give my connections a chance to write final responses within the getStopTimeout() window.  

I'm not sure how I can add a Graceful instance into this process.  Does anybody know how to do this?

Thanks,
Josh


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


--

Back to the top