<div dir="ltr">Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>&gt; writes:<br><br>[...]<br><br>&gt; Yea, we don&#39;t have an easy way to just do that transfer at this stage,<br>&gt; you will need to read into the pooled buffer then write it out.<br>&gt;<br>&gt; Is this an async or a blocking transfer? The problem with<br>&gt; ReadableByteChannel is that it can be a blocking channel, and as a<br>&gt; result reading from it in the IO thread will result in crappy<br>&gt; performance.<br><br>Because of the way they&#39;re using it (with Clojure&#39;s core.async library)<br>I expect the transfer to be async, but I&#39;ll verify that with them.<br><br>You wouldn&#39;t happen to have an example of reading one into and out of a<br>pooled buffer you could point me to, would you? :)<br><br>Jim<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 16, 2014 at 8:37 PM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
Jim Crossley wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I actually figured that out, Stuart, thanks. So I have writing a<br>
ByteBuffer covered. Any thoughts on handling the ReadableByteChannel?<br>
Looking at the Jetty impl, it appears I need to read it into one or more<br>
ByteBuffers and then write them out. Should I use the Pooled&lt;ByteBuffer&gt;<br>
from the exhange&#39;s connection?<br>
</blockquote>
<br></span>
Yea, we don&#39;t have an easy way to just do that transfer at this stage, you will need to read into the pooled buffer then write it out.<br>
<br>
Is this an async or a blocking transfer? The problem with ReadableByteChannel is that it can be a blocking channel, and as a result reading from it in the IO thread will result in crappy performance.<br>
<br>
Stuart<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
Jim<br>
<br>
On Tue, Sep 16, 2014 at 6:00 PM, Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a><br></span><span class="">
&lt;mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;&gt; wrote:<br>
<br>
<br>
<br>
    Jim Crossley wrote:<br>
<br>
        Hi guys,<br>
<br>
        I&#39;m looking to promote Undertow as a preferred alternative to<br>
        Jetty for<br>
        the Pedestal [1] framework.<br>
<br>
        One Jetty feature it relies on is the async sending of<br>
        ByteBuffers and<br>
        ReadableByteChannels in Jetty&#39;s impl of ServletOutputStream [2]. Two<br>
        methods, in particular: sendContent(ByteBuffer, Callback) and<br></span>
        sendContent(__<u></u>ReadableByteChannel, Callback).<span class=""><br>
<br>
<br>
    If you have enabled async mode on the ServletOutputStream then<br>
    write(ByteBuffer) will write using async IO, and invoke the write<br>
    listener when done. Basically it will work the same as standard<br>
    servlet async IO, but with byte buffers.<br>
<br>
    Stuart<br>
<br>
<br>
        I was hoping someone might point me in the right direction of<br>
        replicating this behavior with Undertow&#39;s<br>
        ServletOutputStreamImpl. It<br>
        does have a write(ByteBuffer) method, but it appears to be<br>
        blocking. And<br>
        I was hoping there might be some XNIO abstraction for dealing<br>
        with the<br>
        ReadableByteChannel, perhaps some example code somewhere?<br>
<br>
        Any and all help/advice is appreciated!<br>
        Jim<br>
<br></span>
        [1]: <a href="https://github.com/pedestal/__pedestal" target="_blank">https://github.com/pedestal/__<u></u>pedestal</a><br>
        &lt;<a href="https://github.com/pedestal/pedestal" target="_blank">https://github.com/pedestal/<u></u>pedestal</a>&gt;<br>
        [2]:<br>
        <a href="http://grepcode.com/file/__repo1.maven.org/maven2/org.__eclipse.jetty/jetty-server/9.__2.0.v20140526/org/eclipse/__jetty/server/HttpOutput.java" target="_blank">http://grepcode.com/file/__<u></u>repo1.maven.org/maven2/org.__<u></u>eclipse.jetty/jetty-server/9._<u></u>_2.0.v20140526/org/eclipse/__<u></u>jetty/server/HttpOutput.java</a><br>
        &lt;<a href="http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.jetty/jetty-server/9.2.0.v20140526/org/eclipse/jetty/server/HttpOutput.java" target="_blank">http://grepcode.com/file/<u></u>repo1.maven.org/maven2/org.<u></u>eclipse.jetty/jetty-server/9.<u></u>2.0.v20140526/org/eclipse/<u></u>jetty/server/HttpOutput.java</a>&gt;<br>
<br>
        ______________________________<u></u>___________________<br>
        undertow-dev mailing list<br>
        <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>&gt;<br>
        <a href="https://lists.jboss.org/__mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/undertow-dev</a><br>
        &lt;<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a>&gt;<br>
<br>
<br>
</blockquote>
</blockquote></div><br></div>