Hi,

I have committed a first version of availability support in services. You can now ask ServiceReference's "isAvailable". The default is always "true". 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. That implementation can be arbitrarily complex, but typically checks if the required underlying services are available.

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.

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?

/Rickard

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

Reply via email to