dev@grizzly.java.net

About graceful shutdown

From: Bongjae Chang <bongjae.chang_at_gmail.com>
Date: Mon, 10 Mar 2014 12:04:40 +0900

Hi,
Grizzly provides GracefulShutdownListener interface so custom server can
implement graceful shutdown logic.

When I reviewed NIOTransport#shutdown, there are 3 steps.
1) state set to be STOPPING.
2) unbindAll
3) shutdown listener will be called and checked within period in background
thread and return a future.

At this logic, I have a question above 2) and 3).
I think that all connections will be closed after 2) then server can't send
responses corresponding to requests which were received before the shutdown
operation.

The following is an example.
---
request 1: received
request 2: received
(start to shut down)
request 3: rejected with STOPPING state
request 4: rejected with STOPPING state
..
processing request 1, 2: graceful
..
unbindAll
sending response 1, 2: maybe server canšt send responses because there are
no connections.
---
I think that request 1 and request 2šs responses should be sent to clients
but canšt because connections are already closed.
I donšt know whether I have a right understanding. Please correct me if I am
missing some points.
Thanks!
Regards,
Bongjae Chang