Hi, I think the conceptual problem here is, that OWB has exactly one InstanceBean and one EventBean. In fact we should have one InstanceBean per InjectionPoint. This bean would have enough information to remove the ThreadLocal. But I don't know how much impact such change would have on the code. I'll take a look at that, too. Maybe that could be done with not much changes.
Btw. OWB-567 is that same problem Cheers, Arne -- Arne Limburg - Enterprise Architekt open knowledge GmbH, Oldenburg Bismarckstraße 13, 26122 Oldenburg Mobil: +49 (0) 151 108 22 942 Tel: +49 (0) 441 - 4082-0 Fax: +49 (0) 441 - 4082-111 [email protected] http://www.openknowledge.de Registergericht: Amtsgericht Oldenburg, HRB 4670 Geschäftsführer: Lars Röwekamp, Jens Schumann -----Ursprüngliche Nachricht----- Von: Mark Struberg [mailto:[email protected]] Gesendet: Samstag, 24. September 2011 17:01 An: openwebbeans-dev Betreff: Re: Yan: proper Handling of InjectionPoints Hi! Yes, I think it was the best solution in the short time we had back then. But now we should aim for a better solution I think. Imo we should add the InjectionPoint info to our internal createInstance methods somehow, wdyt? LieGrue, strub >________________________________ >From: Gurkan Erdogdu <[email protected]> >To: "[email protected]" <[email protected]>; Mark >Struberg <[email protected]> >Sent: Saturday, September 24, 2011 3:04 PM >Subject: Yan: proper Handling of InjectionPoints > > >Hello Mark, > > >As far as I remembered, these tricks were required to satisfy circular >injections and some other complex stuff. I have to look at the code in >detailed to provide more satisfying answers! > > > >Cheers, > > >Gurkan > > > > >________________________________ >Kimden: Mark Struberg <[email protected]> >Kime: openwebbeans-dev <[email protected]> Gönderildiği >Tarih: 24 Eylül 2011 13:57 Cumartesi >Konu: proper Handling of InjectionPoints > >Hi! > >Whilst working on OWB-617 I figured that we still have this utterly ugly >public ThreadLocals in a few of our Beans (InstanceBean, EventBean, >InjectionPointBean). >All of them just need the information about the InjectionPoint they get >injected to. Cant we just solve this somehow different? > >This is really broken because of a few reasons: > >1.) Some of this code just crashes with a NPE if the contextual instances get >resolved via BeanManager#getReference manually. Because in this situation >there is no InjectionPoint and the code which usually fills the ThreadLocals >didn't get called earlier... > >2.) We will crash heavily (or more worse: produce wrong results) if the >creation is nested somehow. Because the ThreadLocal can only contain 1 >entry for each thread. but if (while creating one bean) we need to inject another one of that kind, then we are doomed! This situation might happen if we have a few nested @Dependent beans or if we touch a subsequent member in any @Inject or @PostConstruct methods. > >Anyone got an idea how to solve this? Gurkan? >I have looked through our code and have some gut feeling already, but I might >need some feedback from you guys! >We can walk through the code together via IRC or hold a quick voicemail, >teamspeak or skype meeting if you like. > >LieGrue, >strub > > > > > >
