[undertow-dev] Who Needs JAX-RS...

Steve Logue bitvector2 at gmail.com
Mon Aug 31 12:08:16 EDT 2015


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.

-STEVEl


On Mon, Aug 31, 2015 at 5:40 AM, peter royal <peter.royal at pobox.com> wrote:

> 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
>
>
> --
>
> http://www.bitvector.org/
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev
>
>
> --
> (peter.royal|osi)@pobox.com - http://fotap.org/~osi
>



-- 

http://www.bitvector.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20150831/9eaa01d1/attachment.html 


More information about the undertow-dev mailing list