Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Describes which requirements the Karaf boot faces, how we solve it at the moment and ideas how to improve the boot.

Requirements

1. The OSGi Framework should be switchable (We currently support Equinox and Felix)
2. Some projects like Camel and CXF need to change some javax interfaces and implementations. At the same time we do not want these alternative implementations all the time
3. The Karaf "core" should be as small as possible. Extensions should be defined using features
4. Support optional bundle resolution in features using an OBR
5. Support pax url handlers to load bundles
6. Make Karaf startup fast

Current boot (Karaf 3)

The current boot process runs in several stages. Each stage is finished before the next starts.

The first steps of the Karaf boot are done in the main module.

  • Determine the OSGi framework to be used from a config property, load and start the OSGi framework using a classloader that loads the specified framework jar (See Req 1)
  • If we already have bundles managed by the framework (no clean start) then we just let the framework initialize all existing bundles and skip the rest of the steps
  • Load and start all bundles from startup.properties. Each line there references a bundle either using a file: path or a mvn: path. The mvn path uses a simplified resolution that can only work with the karaf system dir. As the start level of the framework is still low the bundles are not yet really started
  • Start all karaf activators. These allow to exchange some javax interfaces and implementations (see Req 2)
  • Set the OSGi framework locking start level (inactive Karaf)
  • Set the real start level as soon as we got the lock

The startup.properties have to contain at least all bundles necessary to do the following:

  • Install the OBR (optionally) (See Req 4)
  • Install all Urlhandlers needed for the feature core bundle and the boot features to be loaded later. (The boot features can not load their url handlers as these have to be started when loading the additional bundles)
  • Install and start the feature service

Installing the boot features

When the feature-core bundle is started it will load all features listed in boot features

  • Each boot feature is started according to their sequence in the config property. For each feature each bundle is started sequentially

Possible improvements

Allow OBR and most urlhandlers to be installed as features to make karaf more modular (Will improve support for Req 3)

The issue https://issues.apache.org/jira/browse/KARAF-608 describes staged boot features to allow to move obr and url handlers out of startup.properties and into features. This will make the Karaf "core" smaller and allow to use additional custom urlhandlers for boot features.

Load bundles in parallel (especially from external resources like maven repos) (Will improve support for Req 6)

Currently we load features and bundles sequentially in the feature core. If we manage to load them in parallel using a set of worker threads we can speed up the clean karaf startup a lot.