Hi Mark,

Where do you want to add the NewBean instances in the code?
I wonder if NewBeans should be threated same as the InstanceBeans, EventBeans 
and InjectionPointBeans that we are recently discussing.

Imho all these beans need special treatment.
If we would take the spec literally we would have to
- Create an InstanceBean for every legal bean-type
- Create a NewBean for each managed bean and for each session bean (however it 
would be disabled if no InjectionPoint exists)
- Create an EventBean for every Java-type that does not contain a type variable 
and for every qualifier type in its set of qualifier types
- Create one InjectionPointBean

However, if we would add all such beans, it would consume far too much memory. 
Having just one bean of each type (like we have currently for InstanceBean, 
EventBean and InjectionPointBean) is not enough, since we need additional 
information in this ugly and buggy ThreadLocal. Btw. the NewBean could have 
been implemented the same way, but was not.

So if we don't want to create every bean that is needed by the spec on 
container-startup, we have to create them later. And this should take place at 
one certain point in code.
This point in code is imho the Injection-Resolver since it already caches the 
beans and we would not create one and the same bean twice. WDYT?

Or am I completely wrong and we should tread all this beans separately?

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 (Commented) (JIRA) [mailto:[email protected]] 
Gesendet: Dienstag, 27. September 2011 11:54
An: [email protected]
Betreff: [jira] [Commented] (OWB-619) @New beans must only exist if there is at 
least one injection point for them


    [ 
https://issues.apache.org/jira/browse/OWB-619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13115370#comment-13115370
 ] 

Mark Struberg commented on OWB-619:
-----------------------------------

I agree that it's not very user friendly, but honestly: did you ever use @New ? 
;) It's practically irrelevant, because it is only intended for the @Inject 
@New(MyClass.class) use case. There is no dynamic nor whatever lookup allowed 
by the spec atm. You cannot even trigger producer methods or fields with it...
                
> @New beans must only exist if there is at least one injection point 
> for them
> ----------------------------------------------------------------------
> -------
>
>                 Key: OWB-619
>                 URL: https://issues.apache.org/jira/browse/OWB-619
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.1
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 1.1.2
>
>
> spec section 3.12 @New defines
> >For each managed bean, and for each session bean, a second bean exists which 
> >....
> ...
> > is enabled, in the sense of Section 5.1.2, "Enabled and disabled beans", if 
> > and only if some other enabled bean has an injection point with the 
> > qualifier @New(X.class) where X is the bean class.
> Which means that we dont need to create a NewBean for each and every bean, 
> but only for ones which gets used in an InjectionPoint somewhere!
> This can massively reduce the amount of needed beans and the mem 
> consumption of OWB

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to