dev@glassfish.java.net

Re: added feature to hk2

From: Jerome Dochez <Jerome.Dochez_at_Sun.COM>
Date: Thu, 25 Jun 2009 01:28:06 -0700

Tim Quinn wrote:
> Jerome Dochez wrote:
>> Hi
>>
>> I don't remember who outside of Tim needed that feature but I added
>> the ability to figure out if a service has been initialized or not
>> (useful for singleton services really).
>>
>> the pattern is pretty simple, look at the LazyInitialization unit
>> test in hk2, but in short
>>
>> Inhabitant<HeavyBean> inhabitant =
>> habitat.getInhabitantByType(HeavyBean.class);
>> if (inhabitant.isInstantiated()) {
>> // service was used
>> } else {
>> // service was not used.
>> }
>>
>> let me know if you run into issues.
> The Inhabitant#isInstantiated method needs to be public.
>
it is public, not sure what you mean here ?
> The 0.3.67-SNAPSHOT artifacts aren't published yet but I guess that'll
> happen automatically soon?
>
it was published with 0.3.66 so you should have it now.

> Thanks. This isInstantiated method is just what the ACC needed.
>
> - Tim
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>