Hello
I have the commet application - some sort of event bus where requests are
turned in async mode then stored in internal cache and when event occures
/ or request times out response is sent back to subscriber (it is handled
with my executor worker threads).
It worked fine until I have added a line with calling flushBuffer on
response object. My goal was to mark the connection as commited - I am
checking whether I have already written to this response
(response.isCommited()) in some other part of my code.
Now errors like these pop out in my logs
java.lang.NullPointerException
at
org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:210)
at
org.apache.coyote.http11.InternalNioOutputBuffer.commit(InternalNioOutputBuffer.java:202)
at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:765)
at org.apache.coyote.Response.action(Response.java:174)
at org.apache.coyote.Response.sendHeaders(Response.java:354)
at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:330)
at
org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:306)
at org.apache.catalina.connector.Response.flushBuffer(Response.java:568)
at
org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:307)
.... my code calling flushBuffer() on HttpResponse object
....
.... worker thread
public void send(HttpServletResponse response) { // calling from worker
threads
if (response.isCommitted()) {
throw new IOException("ERROR");
}
response.getWriter().print("RESPONSE");
response.flushBuffer(); // <---- FAILED HERE
}
Did I miss some curtial lesson about flushing async responses ?
PS.
By the way that NPE should never occur - Is it a BUG ? I am using Tomcat
7.0.28 (current in debian 7.0 Wheezy)
--
Peter Cipov
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org