[undertow-dev] Checking if an exchange has been dispatched
Stuart Douglas
sdouglas at redhat.com
Tue Sep 2 20:53:15 EDT 2014
isDispatched() will only return true if a dispatch is going to happen
when the call stack returns.
So when you are in the IO thread and call the dispatch() method from
that point on isDispatched() will be true, however as soon as the call
stack returns and the dispatch happens this goes back to false (as it is
possible to dispatch multiple times).
The check you are probably looking for is exchange.isInIoThread(), which
will return true if the current thread is the IO thread.
Stuart
Shannon Lloyd wrote:
> Hi,
>
> If I dispatch an exchange within a handler, and later confirm that it is
> being executed by one of the "task" threads, should I expect
> exchange.isDispatched() to return true?
>
> Because I'm not seeing this behaviour (using 1.0.15.Final). If I pause
> execution in the debugger, I can see that the executing thread is XNIO-1
> task-1, but exchange.isDispatched() returns false. If it helps,
> exchange.state == 151752.
>
> Does isDispatched() not mean what I think it means (i.e. that execution
> has actually commenced via the task pool)?
>
> Thanks,
> Shannon
>
> _______________________________________________
> 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