You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Martin Lichtin <li...@yahoo.com> on 2013/04/16 16:23:06 UTC

bundle start-order in a feature

Hi

can you clarify how start-order is accounted for when used as part of a feature?
For example

    <feature version="1.0.0" name="ftr">
        <bundle>b1</bundle>
        <bundle start-level="60">b2</bundle>
        <bundle start-level="55">b3</bundle>
    </feature>


As far as I can see, the start-level value has no effect. 

It is not taken into account during feature:install or feature:uninstall.

I see that after Karaf (2.3.1) starting up, the framework start-level is at 100.
The default start-level of the feature bundles, eg. b1 in above example, is 80.
So then, when running "feature:install ftr", I would expect the start order: b3,b2,b1
For "feature:uninstall ftr", I would expect stop order: b1,b2,b3.

Any clarifications appreciated!

Martin

Re: bundle start-order in a feature

Posted by Martin Lichtin <li...@yahoo.com>.
Agreed.
It is the Import- and Export-Package dependencies that are determining the start order, besides the framework versus bundle start-level.
When moving the framework start-level (from lvl1 to lvl2), bundles with start-level between lvl1 and lvl2 are started (or stopped) in sequence (with no defined ordering for bundles with the same start-level).


However, I am talking here about the Karaf semantics of feature:install and feature:uninstall.
I just learned that the start-level is in fact 'respected', starting with Karaf 3.x, when doing a feature installation (KARAF-1878).
Good news :) and it would be great (also to make this behaviour consistent), if the internal bundle ordering would be done for the "uninstall" case as well.


Martin




>________________________________
> From: Jamie G. <ja...@gmail.com>
>To: user@karaf.apache.org; Martin Lichtin <li...@yahoo.com> 
>Sent: Wednesday, April 17, 2013 7:28 PM
>Subject: Re: bundle start-order in a feature
> 
>
>
>Start level and start order are two different concepts in OSGi.
>
>
>The start level is defined to be a state of execution in which the Framework exists. StartLevel values are defined as unsigned integers with 0 (zero) being the state where the Framework is not launched. Progressively higher integral values represent progressively higher start levels. e.g. 2 is a higher start level than 1. In Apache Karaf we use the scale from 0 to 100.
>
>
>The start order of bundles in not guaranteed in OSGi (not part of the spec). Since bundles can come and go at runtime its best practice to write your applications to be aware of these conditions. Once approach you may take is to have your bundles export and import each other as dependencies - in this way the framework will not start your bundles until it's dependencies are available (for bundles A, B, and C, having B require A, and C require B should result in C not starting until A & B are available).
>
>
>Cheers,
>Jamie
>
>
>
>On Tue, Apr 16, 2013 at 11:53 AM, Martin Lichtin <li...@yahoo.com> wrote:
>
>Hi
>>
>>
>>can you clarify how start-order is accounted for when used as part of a feature?
>>For example
>>
>>
>>    <feature version="1.0.0" name="ftr">
>>       
 <bundle>b1</bundle>
>>        <bundle start-level="60">b2</bundle>
>>        <bundle start-level="55">b3</bundle>
>>    </feature>
>>
>>
>>
>>As far as I can see, the start-level value has no effect. 
>>
>>It is not taken into account during feature:install or feature:uninstall.
>>
>>
>>I see that after Karaf (2.3.1) starting up, the framework start-level is at 100.
>>The default start-level of the feature bundles, eg. b1 in above example, is 80.
>>So then, when running "feature:install ftr", I would expect the start order: b3,b2,b1
>>For "feature:uninstall ftr", I would expect stop order: b1,b2,b3.
>>
>>
>>Any clarifications appreciated!
>>
>>Martin
>>
>>
>
>
>

Re: bundle start-order in a feature

Posted by "Jamie G." <ja...@gmail.com>.
Start level and start order are two different concepts in OSGi.

The start level is defined to be a state of execution in which the
Framework exists. StartLevel values are defined as unsigned integers with 0
(zero) being the state where the Framework is not launched. Progressively
higher integral values represent progressively higher start levels. e.g. 2
is a higher start level than 1. In Apache Karaf we use the scale from 0 to
100.

The start order of bundles in not guaranteed in OSGi (not part of the
spec). Since bundles can come and go at runtime its best practice to write
your applications to be aware of these conditions. Once approach you may
take is to have your bundles export and import each other as dependencies -
in this way the framework will not start your bundles until it's
dependencies are available (for bundles A, B, and C, having B require A,
and C require B should result in C not starting until A & B are available).

Cheers,
Jamie


On Tue, Apr 16, 2013 at 11:53 AM, Martin Lichtin <li...@yahoo.com> wrote:

> Hi
>
> can you clarify how start-order is accounted for when used as part of a
> feature?
> For example
>
>     <feature version="1.0.0" name="ftr">
>         <bundle>b1</bundle>
>         <bundle start-level="60">b2</bundle>
>         <bundle start-level="55">b3</bundle>
>     </feature>
>
> As far as I can see, the start-level value has no effect.
> It is not taken into account during feature:install or feature:uninstall.
>
> I see that after Karaf (2.3.1) starting up, the framework start-level is
> at 100.
> The default start-level of the feature bundles, eg. b1 in above example,
> is 80.
> So then, when running "feature:install ftr", I would expect the start
> order: b3,b2,b1
> For "feature:uninstall ftr", I would expect stop order: b1,b2,b3.
>
> Any clarifications appreciated!
>
> Martin
>
>