In a dispatched non-blocking HttpRequest handler I'm calling endExchange immediately after calling send on the response Sender. I am unsure if this will cause the sender to be interrupted or if the exchange will end only after the sender is done writing the data.

The code looks like this:

@Override
public void handleRequest(HttpServerExchange exchange) throws Exception
{
    if (exchange.isInIoThread()) {
        exchange.dispatch(this);
        return;
    }
   
    try {
        ... do things ...
        exchange.getResponseSender().send(data);
    }finally {
        exchange.endExchange();
    }
}