while (System.currentTimeMillis() < timeout) {
prepareSSEContinue(httpServletResponse);
outputStream.flush();
queue.poll(TimeUnit.MILLISECONDS, getSSETimeout(), new OutputStreamWriteAdapter(outputStream));
outputStream.write(SSE_TERMINATION_BYTES);
queue.heartBeat();
}
}
else if (wait) {
queue.poll(TimeUnit.MILLISECONDS, getLongPollTimeout(), new OutputStreamWriteAdapter(outputStream));
}