<div dir="ltr"><div><div><div><div><div><div>Hi,<br><br></div>I posted my question on wildfly-dev (<a href="http://lists.jboss.org/pipermail/wildfly-dev/2014-March/001986.html">http://lists.jboss.org/pipermail/wildfly-dev/2014-March/001986.html</a>) but I think this one is better, as the implementation is in undertow-servlet, not in wildfly itself.<br>
<br></div>I would like to use non-blocking input and output at the same time. For the simplicity let&#39;s implement EchoProtocol - check the attachments.<br><br></div>As you see, the writer is in a separate thread created by manually (which is a bit smelly IMHO). Another point is that I do the write directly without checking whether I can write without blocking. In fact, when I call ServletOutputStream.isReady() I get the Undertow error: &quot;UT010034: Stream not in async mode&quot;<br>
<br>Checking the source code you are not really sure if it&#39;s a correct behaviour:<br>
<br><span style="font-family:courier new,monospace">io.undertow.servlet.spec.UpgradeServletOutputStream<br>io.undertow.servlet.spec.ServletOutputStreamImpl<br>    @Override<br>    public boolean isReady() {<br>        if (listener == null) {<br>
          <b>  <span style="color:rgb(255,0,0)">//TODO: is this the correct behaviour?</span></b><br>
            throw UndertowServletMessages.MESSAGES.streamNotInAsyncMode();<br>        }</span><br><br></div>Another point - more to non-blocking itself. How can ServletOutputStream.write(byte b[]) be non-blocking at all? Let&#39;s imagine that the socket is ready to write and I call write with a buffer of 1000 bytes but the receiver is ready only to receive 500 bytes at this point. My call will be blocked, right?<br>
<br></div>Cheers,<br></div>Przemyslaw<br><div><div><div><div><br></div></div></div></div></div>