On Mon, Nov 15, 2010 at 4:31 PM, Rickard Öberg <[email protected]> wrote:

> I have committed a first version of availability support in services. You
> can now ask ServiceReference's "isAvailable". The default is always "true".

Ok.

> If the service has a configuration that extends Enabled (that has a
> Property<Boolean> enabled()), that will be checked. If the service then also
> implements AvailableService.isAvailable(), that will also be checked for
> more dynamic determination.

Maybe called "interface Availability" instead, since AvailableService
sounds like other services are Unavailable ;-)


> There is also a service qualifier @Available that can be used for DI.
> Example:
> @Service @Optional @Available MyService service;
> will only inject a service if it's currently available, otherwise null.

And this happens once? What if one has

@Service @Available ServiceReference<MyService> ref;

??
I assume the ref will not be null, even if the service is not available.

A follow-up should possibly be that ServiceProvider (importedService)
can make services available/un-available after the initial start-up,
and finally I still would like to see a listener/notification of that
be exposed somehow (maybe on the ServiceReference).

Further, I assume that a NotAvailableException is also defined, as
from you call isAvailable() until you make the call to the service, it
may no longer be available...

> I was initially considering replacing isActive with isAvailable, but
> currently they are both there. Does it make sense to have isActive() in an
> API, or is that maybe more SPI'ish functionality as it relates to the
> underlying service rather than usage?

I can't see the difference. Either I would view "not Active" as a sub
case of "not Available", or there is a domain specific meaning to it,
in which case it belong in the the domain code. But I am not having a
strongly formed opinion at the moment.


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to