karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: What's the lifecycle of a bundle in a feature vs a bundle loaded directly by a feature? (Was: "No suitable driver found" after postgresql driver bundle reload)
Date Sat, 27 Apr 2019 05:48:29 GMT
Generally the karaf feature mechanism tries to load and start bundles only
Unfortunately there are cases when bundles have to be refreshed and

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.


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

> >>>>> Steinar Bang <sb@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

Computer Scientist

View raw message