Interface FunctionalityReady


  • public interface FunctionalityReady
    Marker interface for ready functionality. Implemented by interfaces used purely to “signal” e.g. “state changes” during boot up for specific “functionality” offered by a bundle. Another bundle can then await the respective “boot event” by declaring a regular OSGi service dependency to it (using e.g.Blueprint BP, or Declarative Services DS). This allows to order the boot sequence.

    BP (or DS) of course already implicitly do service initialization ordering according to the dependency graph (but beware of BP's use of java.lang.reflect.Proxy). This infrastructure is therefore useful only if:

    1. there is no natural service interface, or
    2. a service does further more heavy weight initialization asynchronously in a background thread in order not to block e.g. Blueprint, and wants to signal when that background initialisation is really ready to anything that must be specifically aware of that,
    3. you need more “fine grained” signaling than the availability of your main service interface/s can indicate.

    Some examples where this is useful include:

    • Infrautils’ own system ready service signaling that all features have booted all bundles without errors and all blueprint initialization is completed (similar to Karaf own org.apache.karaf.features.BootFinished),
    • Daexim’s import on boot completed successfully.

    Interfaces extending this one typically have no methods. By convention, they are named with a *Ready suffix.

    This is just a convenience maker interface. One could well just use the “pattern” proposed by this without implementing this interface, nor using FunctionalityReadyNotifier. However, using this gives a clear indication that a “fake service” has this purpose, and allows one to find them all by type, as well as directly refer to this documentation.

    Author:
    Michael Vorburger.ch
    See Also:
    FunctionalityReadyNotifier