/** * This method is used to flush the contents of the buffer to the client. This method will block * until such time as all of the data has been sent to the client. If at any point there is an * error sending the content an exception is thrown. */ public void flush() throws IOException { try { if (!monitor.isClosed()) { sender.flush(); } } catch (Exception cause) { if (sender != null) { monitor.close(sender); } throw new ProducerException("Error sending response", cause); } }