You are blocking the IO thread in each of your handlers.

 

When each handler is a class, you can do:

 

if( exchange.isInIoThread()) {

  exchange.dispatch(this);

  return;

}

 

but since you are using lambda's, that won't work. In this case, you might want to just pass a Runnable to exchange.dispatch()

 

that will put you on a worker pool thread where it is safe to block on the Await.result call.

 

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.

 

-pete

 

 

 

 

On 2015-08-29 21:00, Steve Logue wrote:

Hi Folks, I'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:
 
https://github.com/bitvector2/microservice2/blob/master/src/main/java/org/bitvector/microservice2/HttpActor.java
 
-STEVEl

 
--

_______________________________________________
undertow-dev mailing list
undertow-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev

 

-- 
(peter.royal|osi)@pobox.com - http://fotap.org/~osi