dev@glassfish.java.net

Re: added feature to hk2

From: Tim Quinn <Timothy.Quinn_at_Sun.COM>
Date: Wed, 24 Jun 2009 07:25:06 -0500

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.

The 0.3.67-SNAPSHOT artifacts aren't published yet but I guess that'll
happen automatically soon?

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
>