It seems logical to me.

Regards,
Edward Yakop

On Mon, May 24, 2010 at 17:57, Rickard Öberg <[email protected]> wrote:

> Hi,
>
> As I'm working on OSGi, especially on how to import OSGi service into Qi4j,
> I've stumbled upon ServiceReference.isActive(). The idea is to be able to
> call this method to check whether the imported service is available or not,
> before trying to use it. In Streamflow I want to do this check to turn
> on/off features in the UI, depending on what plugins have been installed on
> the server, basically.
>
> Right now ImportedServiceReference.isActive() looks like this:
>    public boolean isActive()
>    {
>        return serviceInstance != null && serviceInstance.isActive();
>    }
> ---
>
> But this means that if I haven't called get() on the reference, isActive()
> will always return false, since serviceInstance == null.
>
> Since what I want is to know whether the external service is available or
> not I'd propose to change this to:
>    public boolean isActive()
>    {
>        getInstance();
>        return serviceInstance.isActive();
>    }
> ---
> Which ensures that the importer has tried to connect to the external
> service provider, has returned a service proxy, and now I can use the
> service instance to determine if the backing service is there or not.
>
> Does that make sense?
>
> /Rickard
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to