<div dir="ltr">Stuart Douglas <<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>> writes:<br><br>[...]<br><br>> Yea, we don't have an easy way to just do that transfer at this stage,<br>> 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<br>> ReadableByteChannel is that it can be a blocking channel, and as a<br>> result reading from it in the IO thread will result in crappy<br>> performance.<br><br>Because of the way they're using it (with Clojure's core.async library)<br>I expect the transfer to be async, but I'll verify that with them.<br><br>You wouldn'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"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></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<ByteBuffer><br>
from the exhange's connection?<br>
</blockquote>
<br></span>
Yea, we don'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 <<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a><br></span><span class="">
<mailto:<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>>> wrote:<br>
<br>
<br>
<br>
Jim Crossley wrote:<br>
<br>
Hi guys,<br>
<br>
I'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'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'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>
<<a href="https://github.com/pedestal/pedestal" target="_blank">https://github.com/pedestal/<u></u>pedestal</a>><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>
<<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>
<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> <mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>><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>
<<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a>><br>
<br>
<br>
</blockquote>
</blockquote></div><br></div>