https://issues.apache.org/bugzilla/show_bug.cgi?id=55381
Bug ID: 55381 Summary: Issue with the Non Blocking API & TestNonBlockingAPI test Product: Tomcat 8 Version: trunk Hardware: PC OS: Mac OS X 10.4 Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: dmik...@gopivotal.com Looking at the the NBReadServlet class included in TestNonBlockingAPI, the class appears to be directly calling the ReadListener.onDataAvailable() method. @WebServlet(asyncSupported = true) public class NBReadServlet extends TesterServlet { private static final long serialVersionUID = 1L; public volatile TestReadListener listener; @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // step 1 - start async AsyncContext actx = req.startAsync(); actx.setTimeout(Long.MAX_VALUE); actx.addListener(new AsyncListener() { // removed for brevity }); // step 2 - notify on read ServletInputStream in = req.getInputStream(); listener = new TestReadListener(actx); in.setReadListener(listener); listener.onDataAvailable(); } } In Section 3.7 of the spec it says... "The onDataAvailable method is invoked on the ReadListener when data is available to read from the incoming request stream. The container will invoke the method the first time when data is available to read. The container will subsequently invoke the onDataAvailable method if and only if isReady method on ServletInputStream, described below, returns false." ...which leads me to believe that the container should be calling onDataAvailable and not the servlet. If the line "listener.onDataAvailable()" is removed from the test, then the test will hang and ReadListener.onDataAvailable() is never called. The same is true with the NBWriteServlet in TestNonBlockingAPI and the WriteListener.onWritePossible() method. The NBWriteServlet is calling this method directly, while the spec seems to indicate that it should be called by the container. "void onWritePossible(). When a WriteListener is registered with the ServletOutputStream, this method will be invoked by the container the first time when it is possible to write data. The container will subsequently invoke the onWritePossible method if and only if isReady method on ServletOutputStream, described below, returns false." Thanks -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org