I don't think that has anything to do with Undertow, when you call that
method it is out of Undertow's hands (unless you are trying to do something
like reading the request from the exchange in the async task, that would be
racey). Assuming you are not doing anything like that then it is likey some
kind of unrelated bug in your code.
On Mon, Mar 26, 2018 at 4:29 PM, Nabeel Imtiaz <nimtiazm(a)gmail.com> wrote:
Here's the pattern:
public void handleRequest...
//do some I/O intensive work
CompletableFuture.supplyAsync(.../*send email with logged exception handling*/...) //#A
The line #A is inconsistent. The task in #A is executed by a thread in
common forkjoin pool and may be that could be the reason? I'm not sure.
Maybe using one of undertow's worker threads might solve it? Is there a
way to do so? All I want is to return response to the client immediately
and execute delayable work in the background thread.
On Mon, Mar 26, 2018 at 4:50 AM, Stuart Douglas <sdouglas(a)redhat.com>
> How are you running the task? If you just submit it to the worker it
> should just run like any normal executor.
> On Mon, Mar 26, 2018 at 3:31 AM, Nabeel Imtiaz <nimtiazm(a)gmail.com>
>> I'm trying to perform expensive tasks (like sending email/sms etc) as an
>> async task (using CompletableFuture API) after my undertow worker completes
>> and i'm about to respond to the client. These tasks are supposed to work
>> like fire and forget and I don't want to wait until the task completes and
>> then respond to the client.
>> I've noticed that sometimes the task doesn't execute and sometimes it
>> does. It's inconsistent and hard to reproduce. Is there a way to be able to
>> perform these async tasks consistently? May be i'm using wrong thread-pool?
>> Or may be there's already a way in Undertow to do such tasks.
>> Please comment.
>> undertow-dev mailing list