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
