Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-6035

Align to OSGi life cycle specifications

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4
    • Fix Version/s: 5.4.2
    • Component/s: None
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      FRAMEWORK_STARTED must not be used anymore. If you want be execute initialization code after Nuxeo bundles were started override the applicationStarted() method of the DefaultComponent ...
      You MUST not access the BundleContext in component activate method. This object is null in that bundle state. An exception will be thrown if you try to do that.

      Show
      FRAMEWORK_STARTED must not be used anymore. If you want be execute initialization code after Nuxeo bundles were started override the applicationStarted() method of the DefaultComponent ... You MUST not access the BundleContext in component activate method. This object is null in that bundle state. An exception will be thrown if you try to do that.

      Description

      There are 2 major issues in runtime - that are not OSGi compatible:

      1. the FRAMEWORK_STARTED event is incorrectly used:

      • we cannot rely on this event to be sure that all nuxeo components are activated - since this event means that the OSGi framework started and not the application. For example in equinox this event is sent even before activating the Nuxeo runtime.
        To solve this the runtime will send a specific runtime event.
        Then I will rewrite the bootstrap code to avoid relying on FRAMEWORK_STARTED. (this is not urgent for now but will be to be able to start in felix)

      2. Runtime components are activated in the RESOLVE life cycle phase - which is good. But in that phase the BundleContext is not available on true OSGi frameworks. This object is available only after the bundle was started - this means in the BundleActivator.
      Some Nuxeo components are accessing this object in the activate() method which is illegal since on most OSGi frameworks it will throws a NPE. (this is not the case in Equinox - this is why it is working in Apogee - but the specs are clearly saying this). In felix we have a NPE which is normal.
      To solve this I will refactor all components which are accessing the BundleContext in activate().

      This is a first step to be ready to run in any OSGi framework (like felix)

      The next step is to align Nuxeo services on OSGi services but this is a big refactoring (and not urgent)
      Services must be initialized when the bundle is started - this means in a BundleActivator - and not in the component activate() method which is called in RESOLVED state.
      This means moving all Nuxeo service initialization in BundleActivators.
      This also means components will be used only for extension points management and not for providing services.
      I will make later another JIRA tack for this.

        Attachments

          Activity

            People

            • Assignee:
              bstefanescu Bogdan Stefanescu
              Reporter:
              bstefanescu Bogdan Stefanescu
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: