[undertow-dev] dispatch and isDispatched do not agree

Stuart Douglas sdouglas at redhat.com
Tue Nov 22 15:47:19 EST 2016


After the call stack returns and the dispatch actually happens
isDispatched() will return false (allowing the exchange to be
dispatched again).

In general you should not really need to check this anyway, if you
want to know if you are in the IO thread you should use isInIiThread()
instead.

Stuart

On Wed, Nov 23, 2016 at 7:44 AM, Oliver Dain <oliver at analyticspot.com> wrote:
> I've got some pretty simple code that looks something like:
>
> if (!exhange.isDispatched()) {
>     exchange.dispatch(() -> {
>         assert exchange.isDispatched();
>          // more stuff....
>     });
> }
>
> but the assert fails. That is, when dispatch calls my runnable isDispatched
> is not true.
>
> I believe I have a bug somewhere with how/when dispatches are happening so
> I've littered my code with such asserts and they fail reliably even when I'm
> quite sure the exchange has been dispatched (e.g. when it is literally the
> first call in a Runnable passed to to the dispatch() method).
>
> What am I doing wrong?
> --
> CTO, Analytic Spot
> 44 West Broadway #222
> Eugene, OR 97401
> analyticspot.com • 425-296-6556
> www.linkedin.com/in/oliverdain
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev



More information about the undertow-dev mailing list