AsyncContext
is convenient when you do need to keep the connection until you have some data to return after some time in the future without blocking the thread.
In one project I had a remote client which connected to the server and waited (long timeout) for the command from server. So called long-polling approach. Once server has some data to send it takes the AsyncContext
and commits the response. It's very convenient as otherwise we would need to block a thread.