+1 looks good. out of curiosity: did you think about using isContainerEvent to check if the cache should be setup? wonder if it moves from o(2n) to o(n) the complexity (but for an extension n is generally not that crazy not shouldn't change drastically the startup).
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le dim. 10 oct. 2021 à 22:12, Arne Limburg <arne.limb...@openknowledge.de> a écrit : > I have pushed a version to the branch OWB-1393. > > Feel free to take a look at it. If it looks ok, I can merge it tomorrow. > With this version we don’t have to touch the cache, simply registering the > lifecycle observer methods first and only after all lifecycle observer > methods of all extensions are registered, registering the non lifecycle > observer methods of the extensions (which then throws the > ProcessObserverMethod events and correctly sets up the cache). > > Cheers, > Arne > > OPEN KNOWLEDGE GmbH > Poststraße 1, 26122 Oldenburg > Mobil: +49 151 - 108 22 942 > Tel: +49 441 - 4082-154 > Fax: +49 441 - 4082-111 > arne.limb...@openknowledge.de<mailto:arne.limb...@openknowledge.de> > www.openknowledge.de< > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vRVYZVZ%2Feqk%2BvFxU5COofNvgs8U0AxtxRqwVEwqXHA%3D&reserved=0 > > > Registergericht: Amtsgericht Oldenburg, HRB 4670 > Geschäftsführer: Lars Röwekamp, Jens Schumann > > Treffen Sie uns auf kommenden Konferenzen und Workshops: > Zu unseren Events< > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2Fevent%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8tjmukdm1NxhXQMkn4VnESiBI216kXvh%2Fjb7%2FFYI0kE%3D&reserved=0 > > > > Von: Romain Manni-Bucau <rmannibu...@gmail.com> > Datum: Sonntag, 10. Oktober 2021 um 20:04 > An: openwebbeans-dev <dev@openwebbeans.apache.org> > Betreff: Re: OWB-1393 > +1, thanks Arne > > Romain Manni-Bucau > @rmannibucau <https://twitter.com/rmannibucau> | Blog > <https://rmannibucau.metawerx.net/> | Old Blog > <http://rmannibucau.wordpress.com> | Github < > https://github.com/rmannibucau> | > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book > < > https://www.packtpub.com/application-development/java-ee-8-high-performance > > > > > Le dim. 10 oct. 2021 à 20:02, Arne Limburg <arne.limb...@openknowledge.de> > a écrit : > > > Yes, basically that’s my option 2. I am currently implementing it. > > Feel free to review it, when I have pushed it. > > > > Cheers, > > Arne > > > > OPEN KNOWLEDGE GmbH > > Poststraße 1, 26122 Oldenburg > > Mobil: +49 151 - 108 22 942 > > Tel: +49 441 - 4082-154 > > Fax: +49 441 - 4082-111 > > arne.limb...@openknowledge.de<mailto:arne.limb...@openknowledge.de> > > www.openknowledge.de<<http://www.openknowledge.de%3c> > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vRVYZVZ%2Feqk%2BvFxU5COofNvgs8U0AxtxRqwVEwqXHA%3D&reserved=0 > > > > > Registergericht: Amtsgericht Oldenburg, HRB 4670 > > Geschäftsführer: Lars Röwekamp, Jens Schumann > > > > Treffen Sie uns auf kommenden Konferenzen und Workshops: > > Zu unseren Events< > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2Fevent%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8tjmukdm1NxhXQMkn4VnESiBI216kXvh%2Fjb7%2FFYI0kE%3D&reserved=0 > > > > > > > Von: Romain Manni-Bucau <rmannibu...@gmail.com> > > Datum: Sonntag, 10. Oktober 2021 um 18:32 > > An: openwebbeans-dev <dev@openwebbeans.apache.org> > > Betreff: Re: OWB-1393 > > Hmm, > > > > Maybe I misread the options (or misinterpreted them) but think we should: > > > > 1. Register all extensions without any fire > > 2. Start firing events > > > > 2. Means we keep the lazy resolution of observers and can destroy/reset > the > > cache after afterdeploymentvalidation event. > > > > > > No? > > > > Le dim. 10 oct. 2021 à 18:03, Arne Limburg < > arne.limb...@openknowledge.de> > > a écrit : > > > > > Hi, > > > > > > you can fire any Event from extensions and listen to any event in > > > extensions with every of the three options. > > > The first option would have the disadvantage that an extension, that > > > listens to ProcessObserverMethod would not receive the > > > ProcessObserverMethod event for non-lifecycle observer methods of other > > > extensions, which would not be a problem I guess (also I don’t know > what > > > the spec says about it). > > > > > > Imho the second option would be the cleanest. It would basically mean: > > > First register every lifecycle event observer of every extension, then > > > register every non-lifecycle event of every extension (and fire > > > ProcessObserverMethod for every of that observer methods). This would > be > > > valid, too. But it’s the hardest option to implement with the current > > code > > > base. > > > > > > The third variant would mean, that ProcessObserverMethod would be > thrown > > > again, but not every extension would get every ProcessObserverMethod > > event > > > for every non-lifecycle-event of other extensions (which again should > be > > no > > > problem). Or we should disable that cache completely during extension > > > registration. > > > > > > Writing that, I will take a deeper look at variant two or three. > > > > > > Cheers, > > > Arne > > > > > > OPEN KNOWLEDGE GmbH > > > Poststraße 1, 26122 Oldenburg > > > Mobil: +49 151 - 108 22 942 > > > Tel: +49 441 - 4082-154 > > > Fax: +49 441 - 4082-111 > > > arne.limb...@openknowledge.de<mailto:arne.limb...@openknowledge.de> > > > www.openknowledge.de<<http://www.openknowledge.de%3c< > http://www.openknowledge.de%3c%3chttp:/www.openknowledge.de%3c>> > > > > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vRVYZVZ%2Feqk%2BvFxU5COofNvgs8U0AxtxRqwVEwqXHA%3D&reserved=0 > > > > > > > Registergericht: Amtsgericht Oldenburg, HRB 4670 > > > Geschäftsführer: Lars Röwekamp, Jens Schumann > > > > > > Treffen Sie uns auf kommenden Konferenzen und Workshops: > > > Zu unseren Events< > > > > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2Fevent%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8tjmukdm1NxhXQMkn4VnESiBI216kXvh%2Fjb7%2FFYI0kE%3D&reserved=0 > > > > > > > > > > Von: Romain Manni-Bucau <rmannibu...@gmail.com> > > > Datum: Sonntag, 10. Oktober 2021 um 17:39 > > > An: openwebbeans-dev <dev@openwebbeans.apache.org> > > > Betreff: Re: OWB-1393 > > > Hi > > > > > > 3 sounds the only valid option since it is valid and used to fire any > > event > > > in extensions and is used to communicate between them from time to > time. > > > > > > Hope it helps. > > > > > > Le dim. 10 oct. 2021 à 13:57, Arne Limburg < > > arne.limb...@openknowledge.de> > > > a écrit : > > > > > > > FYI, > > > > I now went with solution 1 and pushed it to a branch. If there are no > > > > objections, I’ll merge it tomorrow or so. > > > > > > > > Cheers, > > > > Arne > > > > > > > > OPEN KNOWLEDGE GmbH > > > > Poststraße 1, 26122 Oldenburg > > > > Mobil: +49 151 - 108 22 942 > > > > Tel: +49 441 - 4082-154 > > > > Fax: +49 441 - 4082-111 > > > > arne.limb...@openknowledge.de<mailto:arne.limb...@openknowledge.de> > > > > www.openknowledge.de<<http://www.openknowledge.de%3c<< > http://www.openknowledge.de%3c%3chttp:/www.openknowledge.de%3c%3c> > > http://www.openknowledge.de%3c%3chttp:/www.openknowledge.de%3c>> > > > > > > > > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vRVYZVZ%2Feqk%2BvFxU5COofNvgs8U0AxtxRqwVEwqXHA%3D&reserved=0 > > > > > > > > > Registergericht: Amtsgericht Oldenburg, HRB 4670 > > > > Geschäftsführer: Lars Röwekamp, Jens Schumann > > > > > > > > Treffen Sie uns auf kommenden Konferenzen und Workshops: > > > > Zu unseren Events< > > > > > > > > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2Fevent%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8tjmukdm1NxhXQMkn4VnESiBI216kXvh%2Fjb7%2FFYI0kE%3D&reserved=0 > > > > > > > > > > > > > Von: Arne Limburg <arne.limb...@openknowledge.de> > > > > Datum: Sonntag, 10. Oktober 2021 um 12:34 > > > > An: dev@openwebbeans.apache.org <dev@openwebbeans.apache.org> > > > > Betreff: OWB-1393 > > > > Hi, > > > > > > > > I’ve created OWB-1393 and am going to fix it. > > > > > > > > When we find an extension that contains an observer method, that > > observes > > > > an event that is no lifecycle event, we currently fire > > > > ProcessObserverMethod during addExtension(…) (before every Extension > is > > > > registered). That leads to a caching problem. We cache too early (and > > > thus > > > > too less entries) and don’t invalidate the cache later. > > > > > > > > Note: org.apache.cxf.cdi.JAXRSCdiResourceExtension observes a > > > > non-lifecycle event, so we have that bug currently in meecrowave > > (where I > > > > observed it). > > > > > > > > That leads me to a few questions: > > > > > > > > Is it covered by the spec, that an extension may contain > non-lifecycle > > > > events? > > > > If not: Should we throw an exception then, which would break CXF and > > thus > > > > Meecrowave. > > > > > > > > In any case, how should we handle it? > > > > 1. Don’t fire ProcessObserverMethod during extension registration at > > all? > > > > 2. First register every Lifecycle-Event-Observer during extension > > > > registration and only then register the non-lifecycle-Observers > (which > > > > fires the ProcessObserverMethod events)? > > > > 3. Invalidate that cache after extension registration (probably the > > most > > > > inperformant way)? > > > > > > > > Any opinion? > > > > > > > > Cheers, > > > > Arne > > > > OPEN KNOWLEDGE GmbH > > > > Poststraße 1, 26122 Oldenburg > > > > Mobil: +49 151 - 108 22 942 > > > > Tel: +49 441 - 4082-154 > > > > Fax: +49 441 - 4082-111 > > > > arne.limb...@openknowledge.de<mailto:arne.limb...@openknowledge.de> > > > > www.openknowledge.de<<http://www.openknowledge.de%3c<< > http://www.openknowledge.de%3c%3chttp:/www.openknowledge.de%3c%3c> > > http://www.openknowledge.de%3c%3chttp:/www.openknowledge.de%3c>> > > > > > > > > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vRVYZVZ%2Feqk%2BvFxU5COofNvgs8U0AxtxRqwVEwqXHA%3D&reserved=0 > > > > <http://www.openknowledge.de%3chttps:/ > > > > > > > > > > eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9vRVYZVZ%2Feqk%2BvFxU5COofNvgs8U0AxtxRqwVEwqXHA%3D&reserved=0 > > > > >> > > > > Registergericht: Amtsgericht Oldenburg, HRB 4670 > > > > Geschäftsführer: Lars Röwekamp, Jens Schumann > > > > > > > > Treffen Sie uns auf kommenden Konferenzen und Workshops: > > > > Zu unseren Events< > > > > > > > > > > https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.openknowledge.de%2Fevent%2F&data=04%7C01%7C%7C3004d8758be44c8678c008d93bcc1e23%7C48837bc476f9481d8a76bd7b60b43dec%7C0%7C0%7C637606570139932909%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8tjmukdm1NxhXQMkn4VnESiBI216kXvh%2Fjb7%2FFYI0kE%3D&reserved=0 > > > > > > > > > > > > > > >