Quiescing HTTP2 server

Does anyone have any suggestions on how to implement quiescing of HTTP2 channels when shutting down a server? For context this is a server not built with NIOAsyncChannel so needs to use the quiescing helper from NIOExtras.

On an HTTP1 channel after receiving the quiesce event I would wait until any in progress request had responded before closing the channel but I don’t see how I can implement this for http2 stream channels when the quiesce user event isn’t propagated to the stream channels. And how do I know if the HTTP2 channel has no active stream channels so I can then close that channel.

As stream channels are single-use this is generally not worthwhile. You may want to propagate the event further down into the stream channels if you want to have timeouts propagated, but if you're just going to wait until the request is done then you don't have to do anything else here.

Unfortunately at the moment you have to implement a channel handler that keeps track of the stream open/close user events as you can see here.

Thanks Cory. I wasn’t sure if streams were single use or were kept around to be reused. That certainly makes it easier.

That doesn’t look too hard. Cheers