[jboss-dev] Re: jbossas -beans.xml opt

Jaikiran Pai jpai at redhat.com
Thu May 14 05:59:09 EDT 2009


Thanks Ales.

Based on the discussion in that thread, i understand that the "lazy" 
bean will be activated on the first access (of constructor, field or 
method). So here's a silly question - What stops a MC bean developer to 
mark all (or most of beans) as lazy? :) That way, almost of the beans 
are going to be inited (and passed through various MC lifecycle phases?) 
only when they are accessed. Would this be considered a right approach?

-Jaikiran

Ales Justin wrote:
> http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154873
>
> Jaikiran Pai wrote:
>> Is there any place (forum or wiki or anything else) where i can read 
>> about its usage or more about where these kind of lazy beans would 
>> come in handy?
>>
>> -Jaikiran
>> Ales Justin wrote:
>>>> What are the SomeBeanProxy and OtherBeanProxy in these examples? 
>>>
>>> Those are the lazy proxies generated by <lazy/>.
>>>
>>> We try to use the best lazy mechanism available.
>>> (1) Javassist (allows for class exposure in a proxy)
>>> (2) JBossAOP (although currently if this exists, (1) should too)
>>> (3) JDK dynamic proxies (needs interfaces)
>>>
>>> I would need to check if we can avoid the explicit injection,
>>> and use lazy nested directly:
>>>
>>> <property name="someProp"><lazy bean"SomeBean"/></property>
>>>
>>>> And when exactly are these "lazy" beans installed?
>>>
>>> They have a dependency on the "bean", at Not_Installed state.
>>> Meaning the minute "bean" is installed in MC, you can have lazy 
>>> proxy for it.
>>>
>>>> -Jaikiran
>>>> Ales Justin wrote:
>>>>> Aha, another thing you can use to optimize things.
>>>>> It's the lazy install of OnDemand beans.
>>>>>
>>>>> e.g.
>>>>> <bean name="SomeBean" class="org.jboss.acme.Acme" mode="On Demand"/>
>>>>>
>>>>> <lazy bean="SomeBean">
>>>>>    <interface>org.jboss.acme.IAcme<interface>
>>>>> </lazy>
>>>>>
>>>>> <bean name="DependantBean" class="org.jboss.foobar.Foobar">
>>>>>    <constructor>
>>>>>       <parameter><inject bean="SomeBeanProxy"></parameter>
>>>>>    <constructor>
>>>>> </bean>
>>>>>
>>>>> If the bean doesn't have interfaces:
>>>>>
>>>>> <bean name="OtherBean" class="org.jboss.acme.Acme" mode="On Demand"/>
>>>>>
>>>>> <lazy bean="OtherBean" exposeClass="true"/>
>>>>>
>>>>> <bean name="DependantBean" class="org.jboss.foobar.Foobar">
>>>>>    <constructor>
>>>>>       <parameter><inject bean="OtherBeanProxy"></parameter>
>>>>>    <constructor>
>>>>> </bean>
>>>>> _______________________________________________
>>>>> jboss-development mailing list
>>>>> jboss-development at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/jboss-development
>>>>
>>>> _______________________________________________
>>>> jboss-development mailing list
>>>> jboss-development at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/jboss-development
>>>>
>>> _______________________________________________
>>> jboss-development mailing list
>>> jboss-development at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/jboss-development
>>
>> _______________________________________________
>> jboss-development mailing list
>> jboss-development at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-development
>>
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development




More information about the jboss-development mailing list