<div dir="ltr">Steve,<div><br></div><div>At my first look, I felt like you were facing the issue that Peter have pointed out.</div><div>Taking a deeper look into your code, I found out what you have explained on your last email (line 47 of your source code).</div><div>You are right, it seems that you aren&#39;t blocking your IO threads.</div><div><br></div><div>Just keep in mind that it will always dispatch your request into a Worker thread. By design, HttpHandler could be nested in a chain of handlers, and some built in HttpHandlers will dispatch your request into a Worker thread (as AuthenticationCallHandler, per example). Thus, if you plan to wrap your requests with such handlers all of your requests will be dispatched into Worker threads twice per request. To avoid this, you should apply the fix that Peter have suggested already.</div><div><br></div><div>Regards,</div><div>Miere</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 31, 2015 at 1:08 PM Steve Logue &lt;<a href="mailto:bitvector2@gmail.com">bitvector2@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for looking - how does it look now?  This is actually what I had beforehand at some point.  Now it uses a lambda statement to dispatch to the handler method on a worker thread.<div><div><br></div><div>-STEVEl</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 31, 2015 at 5:40 AM, peter royal <span dir="ltr">&lt;<a href="mailto:peter.royal@pobox.com" target="_blank">peter.royal@pobox.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-size:10pt;font-family:Helvetica,Arial,sans-serif">
<p>You are blocking the IO thread in each of your handlers.</p>
<p> </p>
<p>When each handler is a class, you can do:</p>
<p> </p>
<p>if( exchange.isInIoThread()) {</p>
<p>  exchange.dispatch(this);</p>
<p>  return;</p>
<p>}</p>
<p> </p>
<p>but since you are using lambda&#39;s, that won&#39;t work. In this case, you might want to just pass a Runnable to exchange.dispatch()</p>
<p> </p>
<p>that will put you on a worker pool thread where it is safe to block on the Await.result call.</p>
<p> </p>
<p>an alternate (but lacking the timeout option) method I use is to leverage the JDK8 CompletableFuture and use .thenAccept / .exceptionally to return the response when available.</p>
<p> </p>
<p>-pete</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>On 2015-08-29 21:00, Steve Logue wrote:</p>
<blockquote type="cite" style="padding:0 0.4em;border-left:#1010ff 2px solid;margin:0">
<div dir="ltr">
<div>Hi Folks, I&#39;m definitely new to Undertow and super impressed with it.  However the docs are a bit thin in regards to using the RoutingHandler and doing full async processing.  May I ask for a quick check of my approach to using Undertow and trying not to block anywhere:</div>
<div> </div>
<a href="https://github.com/bitvector2/microservice2/blob/master/src/main/java/org/bitvector/microservice2/HttpActor.java" target="_blank">https://github.com/bitvector2/microservice2/blob/master/src/main/java/org/bitvector/microservice2/HttpActor.java</a>
<div>
<div> </div>
<div>-STEVEl</div>
<div><br>
<div> </div><span><font color="#888888">
-- <br>
<div><br><a href="http://www.bitvector.org/" target="_blank">http://www.bitvector.org/</a></div>
</font></span></div><span><font color="#888888">
</font></span></div><span><font color="#888888">
</font></span></div><span><font color="#888888">
<br>
<div style="margin:0;padding:0;font-family:monospace">_______________________________________________<br> undertow-dev mailing list<br> <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br> <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a></div>
</font></span></blockquote><span><font color="#888888">
<p> </p>
<div>
<div style="margin:0;padding:0;font-family:monospace"><span>-- <br> (peter.royal|osi)@<a href="http://pobox.com" target="_blank">pobox.com</a> - <a href="http://fotap.org/~osi" rel="noreferrer" target="_blank">http://fotap.org/~osi</a><br> </span></div>
</div>
</font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><br><a href="http://www.bitvector.org/" target="_blank">http://www.bitvector.org/</a></div>
</div>
_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a></blockquote></div>