Question...

Based on the addition of OWB 1.2.0 to TomEE 1.6.0 snapshot and the
following,

Cleaning up the Bean creation

In the past we had 2 ways to create beans. If an Extension used
ProcessAnnotatedType to tweak the AnnotatedType of a class then we built
the *Bean<T>* from the modified *AnnotatedType<T>*. For cases where the
AnnotatedType did not get modified we took a completely different part and
created the Bean from the Class reflection information. This part came from
a time where there was no AnnotatedType in the spec yet.

In OWB-1.2.0 we now do all the Bean<T> construction based on the
AnnotatedType - regardless if it got provided by a CDI-Extension or
remained unchanged. This made our codebase much easier to maintain! Arne
also did a great job by introducing and cleaning up all the BeanBuilders
and making the final Bean<T> immutable.

(How) Should I modify this code, below, in my app to effectively use OWB
1.2.0?

    /*
     *
http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/spi/BeanManager.html
     * http://struberg.wordpress.com/2012/03/20/why-is-openwebbeans-so-fast/
     */
    @SuppressWarnings("unchecked")
    public <T> T getBean(Class<T> type) {
        Bean<T> bean = (Bean<T>)
beanManager.resolve(beanManager.getBeans(type));
        CreationalContext<T>  creationalContext =
                              beanManager.createCreationalContext(bean);

        return (T) beanManager.getReference(bean, type, creationalContext);
    }




On Tue, Apr 30, 2013 at 8:44 AM, Howard W. Smith, Jr. <
[email protected]> wrote:

> LOL, interesting that you all mentioned OWB 1.1.7, but did not mention OWB
> 1.1.8. I know that TomEE has been using OWB 1.1.8 for some time now. I
> guess OWB 1.2 is somewhat-more-faster than OWB 1.1.8. :) This is REALLY
> peaking my interest! I love fast/performing app!
>
>
> There is no bells and whistle and especially no reflection - just pure
> plain Java bytecode which is blazingly fast!
>
> Btw, we do very similar stuff for non-intercepted methods of
> intercepted/decorated classes. And we also improved the handling of
> intercepted methods and are now more than twice as fast as OWB-1.1.7 (which
> was already very fast).
>
>
> On Tue, Apr 30, 2013 at 8:38 AM, Howard W. Smith, Jr. <
> [email protected]> wrote:
>
>> Interesting, still reading...[1]
>>
>> As result of this unified handling we only stored the native Contextual
>> Instances in the Contexts (Session, Request map, Conversation map, etc).
>> The negative side effect of this approach was that we had to introduce a
>> quite hacky mechanism to regain access to the CreationalContext. Needless
>> to say that this was not only complex but also error prone.
>>
>> [1] http://blogs.apache.org/owb/
>>
>>
>>
>> On Tue, Apr 30, 2013 at 8:35 AM, Howard W. Smith, Jr. <
>> [email protected]> wrote:
>>
>>> +1 cool!
>>>
>>> I'm about to download now/ASAP. I was about to ask you, what do the test
>>> results reveal of recently-added owb 1.2 to tomee 1.6.0 snapshot, but
>>> evidently, you knew where I was going.
>>>
>>>
>>>
>>>
>>> On Tue, Apr 30, 2013 at 8:33 AM, Romain Manni-Bucau <
>>> [email protected]> wrote:
>>>
>>>> cdi 1.0 tcks just passed this morning
>>>>
>>>> *Romain Manni-Bucau*
>>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>>> *Blog: **http://rmannibucau.wordpress.com/*<
>>>> http://rmannibucau.wordpress.com/>
>>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>>> *Github: https://github.com/rmannibucau*
>>>>
>>>>
>>>>
>>>> 2013/4/30 Howard W. Smith, Jr. <[email protected]>
>>>>
>>>> > Are there many more tomee refactorings required, since owb 1.2 is in
>>>> the
>>>> > house? :)
>>>> >
>>>> > I just thought about reading, News from OpenWebBeans-1.2.0 [1], and
>>>> so far
>>>> > it looks interesting.
>>>> >
>>>> > The Apache OpenWebBeans team has been quite busy with big
>>>> refactorings. Big
>>>> > improvements have been made to the proxying mechanism, the Bean
>>>> scanning
>>>> > and the AnnotatedType handling. We managed to improve the overall
>>>> > performance again and now deliver almost native Java like performance
>>>> for
>>>> > our NormalScoping proxies.
>>>> >
>>>> > to read more, click URL below
>>>> >
>>>> > [1] http://blogs.apache.org/owb/
>>>> >
>>>> >
>>>> > On Mon, Apr 29, 2013 at 9:35 AM, Romain Manni-Bucau
>>>> > <[email protected]>wrote:
>>>> >
>>>> > > Hi,
>>>> > >
>>>> > > shouldn't change anything for you (that's the goal and still in
>>>> progress)
>>>> > >
>>>> > > *Romain Manni-Bucau*
>>>> > > *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>>> > > *Blog: **http://rmannibucau.wordpress.com/*<
>>>> > > http://rmannibucau.wordpress.com/>
>>>> > > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>>> > > *Github: https://github.com/rmannibucau*
>>>> > >
>>>> > >
>>>> > >
>>>> > > 2013/4/29 Howard W. Smith, Jr. <[email protected]>
>>>> > >
>>>> > > > Okay, owb 1.2 is in the house. Can you please clarify what is
>>>> changing
>>>> > > with
>>>> > > > bean manager due to OpenWebBeans (owb) version 1.2 and/or
>>>> TOMEE-916[1]?
>>>> > > Any
>>>> > > > risks, pros, cons, performance enhancements, etc...?
>>>> > > >
>>>> > > > I am using bean manager instead of CODI bean manager. that is why
>>>> I'm
>>>> > > > asking. :)
>>>> > > >
>>>> > > > thanks,
>>>> > > > Howard
>>>> > > >
>>>> > > > [1] https://issues.apache.org/jira/browse/TOMEE-916
>>>> > > >
>>>> > >
>>>> >
>>>>
>>>
>>>
>>
>

Reply via email to