Generally the karaf feature mechanism tries to load and start bundles only
once.
Unfortunately there are cases when bundles have to be refreshed and
restarted.

The main reason is when a bundle has an optional package import. So it can
happen that the bundle is first resolved with the optional package not
present and with a new feature installed into the system the package is
there. In this case the bundle will be refreshed to pick up the package.
This includes restarting the bundle.

The second reason is if a bundle depends on another bundle that is being
refreshed. In this case the bundle also needs to be refreshed.

In combination this leads to a lot of refreshs happening in karaf.

When designing a bundle you can influence this by:
1. Try to avoid optional dependencies
2. Place apis in different bundles as APIs are typically used by many other
bundles while the impls are not.
3. API bundles should not have optional dependencies and should depend on
as few other packages as possible.

Christian


Am Sa., 27. Apr. 2019 um 07:23 Uhr schrieb Steinar Bang <s...@dod.no>:

> >>>>> Steinar Bang <s...@dod.no>:
>
> > (I can think of one possible workaround: create a karaf feature that
> > loads the PostgreSQL driver and its dependencies, and load this directly
> > before loading any other features.  Then maybe PostgreSQL won't reload
> > and this problem won't occur)
>
> Here's a followup question: What's the lifecycle of a bundle in a
> feature vs a bundle loaded directly by a feature?
>
> What I mean, is: if I create a feature for the postgresql JDBC driver,
> and then require that feature, will the driver be just loaded and
> started once?
>
> Or will the PostgreSQL JDBC driver bundle be restarted once for every
> feature loading it, like it is today?
>
> Thanks!
>
>
> - Steinar
>
>

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Reply via email to