[cdi-dev] What, if any, guarantees are made about invoking asynchronous event observer methods?

Matej Novotny manovotn at redhat.com
Mon May 15 03:13:22 EDT 2017


Hi Laird,

Thanks for creating a reproducer straight away.
I took a glance at the repo and here is what I think:

TestScenario1/2 are pretty much what we are discussing here - the container terminates and observers don't get notified any more. 
Obviously, if you hang any additional 'thenRun' etc. on top of that, it won't work either.


TestScenario3 is with Weld parallel mode and is IMO out of scope of previous discussion but important nonetheless.
This is indeed weird and I think you are observing a peculiar behaviour of default executor in SE, which is ForkJoinPool.
We have a test[1] for parallel execution in SE, where we defined your own executor (see 'createWeld' method) and it works like a charm.
I think we need to look into FJP to see what's truly going on there.

Matej

____________________________________________________________________________________________
[1]https://github.com/weld/core/blob/master/environments/se/tests/src/test/java/org/jboss/weld/environment/se/test/event/options/mode/NotificationModeTest.java#L63

----- Original Message -----
> From: "Laird Nelson" <ljnelson at gmail.com>
> To: "cdi-dev" <cdi-dev at lists.jboss.org>, "Matej Novotny" <manovotn at redhat.com>
> Sent: Friday, May 12, 2017 7:31:44 PM
> Subject: Re: [cdi-dev] What, if any, guarantees are made about invoking asynchronous event observer methods?
> 
> On Fri, May 12, 2017 at 10:08 AM Laird Nelson <ljnelson at gmail.com> wrote:
> 
> > Martin referred me to https://issues.jboss.org/browse/CDI-570 which is
> > another variant of my questions.
> >
> 
> I've put a Github repo up with some explorations that might be fun or
> interesting to people: https://github.com/ljnelson/weld-570
> 
> Best,
> Laird
> 


More information about the cdi-dev mailing list