You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Alex Sviridov <oo...@mail.ru.INVALID> on 2017/05/12 08:12:32 UTC

Re[2]: Felix: bundle double update with osgi refresh

Hi Richard

Thank you for your answer. However, is there any chance to touch bundleA only once?

For example I have a running osgi framework with two bundles: bundleA and bundleB
which jars are in JARS folder. BundleB depends on BundleA. Now I replace bundleA jar
in JARS folder.

Is there any way to refresh framework (there is new version of bundleA in JARS folder) 
and not to start/stop bundleA twice?

Best regards, Alex


>Среда, 10 мая 2017, 16:55 +03:00 от "Richard S. Hall" <he...@ungoverned.org>:
>
>On 5/10/17 08:16 , Alex Sviridov wrote:
>> Hi all
>>
>> I use Apache Felix 5.4.0 and I have two bundles: bundleA and bundleB. BundleB depends on bundleA.
>>
>> I update bundleA and after that run the following code to do osgi refresh:
>>
>> Bundle systemBundle  = bcx . getBundle ( 0 );
>> FrameworkWiring frameworkWiring  = systemBundle . adapt ( FrameworkWiring . class );
>> frameworkWiring . refreshBundles ( null );
>> (from here  http://stackoverflow.com/a/23361835/5057736 )
>>
>> This code does the following: it stops and starts bundleA and stops and starts bundleB.
>>
>> But why bundleA? I am asking because in result bundleA is two times updated. Is this a bug or what?
>
>The first stop/start is when you do the update, the second is when you 
>do the refresh. The former is historical, since that is the way update() 
>was defined in the first version of the spec (I believe). Later versions 
>of the spec where refreshing was introduced didn't change this behavior 
>for backward compatibility reasons.
>
>If refresh were there from the beginning, then it would have likely been 
>better to have update() simply prepare the updated version and refresh 
>enact it.
>
>-> richard
>
>>
>> Best regards, Alex
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:  users-unsubscribe@felix.apache.org
>For additional commands, e-mail:  users-help@felix.apache.org
>


-- 
Alex Sviridov

Re[2]: Felix: bundle double update with osgi refresh

Posted by Alex Sviridov <oo...@mail.ru.INVALID>.
Thank you. Now it is working as expected.

Суббота, 13 мая 2017, 13:07 +03:00 от Karl Pauls <ka...@gmail.com>:
>
>
>
>On Saturday, May 13, 2017, Alex Sviridov < ooo_saturn7@mail.ru.invalid > wrote:
>>
>>Hi Karl
>>
>>Thank you for your answer. I've tested your solution. I did the following steps:
>>-stopped bundleA
>>-updated bundleA
>>-started bundleA
>>However, BundleB is still using old classes from bundleA after all steps.
>>
>>How can I make BundleB use new classes (automatically) and not to restart bundleA twice?
>
>As Rick mentioned, you have to explicitly refresh inbetween- sorry for not being clear about that. The sequence must be: stop, update, refresh, start.
>
>You can read more about the why here: 
>
>http://felix.apache.org/documentation/tutorials-examples-and-presentations/apache-felix-osgi-faq.html#when-i-update-my-bundle-why-are-my-bundles-old-classes-still-being-used
>
>regards,
>
>Karl
>  >Пятница, 12 мая 2017, 14:38 +03:00 от Karl Pauls < karlpauls@gmail.com >:
>>>
>>>> For example I have a running osgi framework with two bundles: bundleA and bundleB
>>>> which jars are in JARS folder. BundleB depends on BundleA. Now I replace bundleA jar
>>>> in JARS folder.
>>>>
>>>> Is there any way to refresh framework (there is new version of bundleA in JARS folder)
>>>> and not to start/stop bundleA twice?
>>>
>>>Yes, you basically don't just update() but call stop() then update()
>>>and finally start() on bundleA again.
>>>
>>>regards,
>>>
>>>Karl
>>>
>>>> Best regards, Alex
>>>>
>>>>
>>>>>Среда, 10 мая 2017, 16:55 +03:00 от "Richard S. Hall" <  heavy@ungoverned.org >:
>>>>>
>>>>>On 5/10/17 08:16 , Alex Sviridov wrote:
>>>>>> Hi all
>>>>>>
>>>>>> I use Apache Felix 5.4.0 and I have two bundles: bundleA and bundleB. BundleB depends on bundleA.
>>>>>>
>>>>>> I update bundleA and after that run the following code to do osgi refresh:
>>>>>>
>>>>>> Bundle systemBundle  = bcx . getBundle ( 0 );
>>>>>> FrameworkWiring frameworkWiring  = systemBundle . adapt ( FrameworkWiring . class );
>>>>>> frameworkWiring . refreshBundles ( null );
>>>>>> (from here   http://stackoverflow.com/a/23361835/5057736 )
>>>>>>
>>>>>> This code does the following: it stops and starts bundleA and stops and starts bundleB.
>>>>>>
>>>>>> But why bundleA? I am asking because in result bundleA is two times updated. Is this a bug or what?
>>>>>
>>>>>The first stop/start is when you do the update, the second is when you
>>>>>do the refresh. The former is historical, since that is the way update()
>>>>>was defined in the first version of the spec (I believe). Later versions
>>>>>of the spec where refreshing was introduced didn't change this behavior
>>>>>for backward compatibility reasons.
>>>>>
>>>>>If refresh were there from the beginning, then it would have likely been
>>>>>better to have update() simply prepare the updated version and refresh
>>>>>enact it.
>>>>>
>>>>>-> richard
>>>>>
>>>>>>
>>>>>> Best regards, Alex
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail:   users-unsubscribe@felix.apache.org
>>>>>For additional commands, e-mail:   users-help@felix.apache.org
>>>>>
>>>>
>>>>
>>>> --
>>>> Alex Sviridov
>>>
>>>
>>>
>>>--
>>>Karl Pauls
>>> karlpauls@gmail.com
>>
>>
>>--
>>Alex Sviridov
>
>
>-- 
>Karl Pauls
>karlpauls@gmail.com
>


-- 
Alex Sviridov

Re: Felix: bundle double update with osgi refresh

Posted by Karl Pauls <ka...@gmail.com>.
On Saturday, May 13, 2017, Alex Sviridov <oo...@mail.ru.invalid>
wrote:

>
> Hi Karl
>
> Thank you for your answer. I've tested your solution. I did the following
> steps:
> -stopped bundleA
> -updated bundleA
> -started bundleA
> However, BundleB is still using old classes from bundleA after all steps.
>
> How can I make BundleB use new classes (automatically) and not to restart
> bundleA twice?


As Rick mentioned, you have to explicitly refresh inbetween- sorry for not
being clear about that. The sequence must be: stop, update, refresh, start.

You can read more about the why here:

http://felix.apache.org/documentation/tutorials-examples-and-presentations/apache-felix-osgi-faq.html#when-i-update-my-bundle-why-are-my-bundles-old-classes-still-being-used

regards,

Karl


> >Пятница, 12 мая 2017, 14:38 +03:00 от Karl Pauls <karlpauls@gmail.com
> <javascript:;>>:
> >
> >> For example I have a running osgi framework with two bundles: bundleA
> and bundleB
> >> which jars are in JARS folder. BundleB depends on BundleA. Now I
> replace bundleA jar
> >> in JARS folder.
> >>
> >> Is there any way to refresh framework (there is new version of bundleA
> in JARS folder)
> >> and not to start/stop bundleA twice?
> >
> >Yes, you basically don't just update() but call stop() then update()
> >and finally start() on bundleA again.
> >
> >regards,
> >
> >Karl
> >
> >> Best regards, Alex
> >>
> >>
> >>>Среда, 10 мая 2017, 16:55 +03:00 от "Richard S. Hall" <
> heavy@ungoverned.org <javascript:;> >:
> >>>
> >>>On 5/10/17 08:16 , Alex Sviridov wrote:
> >>>> Hi all
> >>>>
> >>>> I use Apache Felix 5.4.0 and I have two bundles: bundleA and bundleB.
> BundleB depends on bundleA.
> >>>>
> >>>> I update bundleA and after that run the following code to do osgi
> refresh:
> >>>>
> >>>> Bundle systemBundle  = bcx . getBundle ( 0 );
> >>>> FrameworkWiring frameworkWiring  = systemBundle . adapt (
> FrameworkWiring . class );
> >>>> frameworkWiring . refreshBundles ( null );
> >>>> (from here  http://stackoverflow.com/a/23361835/5057736 )
> >>>>
> >>>> This code does the following: it stops and starts bundleA and stops
> and starts bundleB.
> >>>>
> >>>> But why bundleA? I am asking because in result bundleA is two times
> updated. Is this a bug or what?
> >>>
> >>>The first stop/start is when you do the update, the second is when you
> >>>do the refresh. The former is historical, since that is the way update()
> >>>was defined in the first version of the spec (I believe). Later versions
> >>>of the spec where refreshing was introduced didn't change this behavior
> >>>for backward compatibility reasons.
> >>>
> >>>If refresh were there from the beginning, then it would have likely been
> >>>better to have update() simply prepare the updated version and refresh
> >>>enact it.
> >>>
> >>>-> richard
> >>>
> >>>>
> >>>> Best regards, Alex
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail:  users-unsubscribe@felix.apache.org
> <javascript:;>
> >>>For additional commands, e-mail:  users-help@felix.apache.org
> <javascript:;>
> >>>
> >>
> >>
> >> --
> >> Alex Sviridov
> >
> >
> >
> >--
> >Karl Pauls
> >karlpauls@gmail.com <javascript:;>
>
>
> --
> Alex Sviridov
>


-- 
Karl Pauls
karlpauls@gmail.com

Re[4]: Felix: bundle double update with osgi refresh

Posted by Alex Sviridov <oo...@mail.ru.INVALID>.
Hi Karl

Thank you for your answer. I've tested your solution. I did the following steps: 
-stopped bundleA
-updated bundleA
-started bundleA
However, BundleB is still using old classes from bundleA after all steps.

How can I make BundleB use new classes (automatically) and not to restart bundleA twice?

>Пятница, 12 мая 2017, 14:38 +03:00 от Karl Pauls <ka...@gmail.com>:
>
>> For example I have a running osgi framework with two bundles: bundleA and bundleB
>> which jars are in JARS folder. BundleB depends on BundleA. Now I replace bundleA jar
>> in JARS folder.
>>
>> Is there any way to refresh framework (there is new version of bundleA in JARS folder)
>> and not to start/stop bundleA twice?
>
>Yes, you basically don't just update() but call stop() then update()
>and finally start() on bundleA again.
>
>regards,
>
>Karl
>
>> Best regards, Alex
>>
>>
>>>Среда, 10 мая 2017, 16:55 +03:00 от "Richard S. Hall" < heavy@ungoverned.org >:
>>>
>>>On 5/10/17 08:16 , Alex Sviridov wrote:
>>>> Hi all
>>>>
>>>> I use Apache Felix 5.4.0 and I have two bundles: bundleA and bundleB. BundleB depends on bundleA.
>>>>
>>>> I update bundleA and after that run the following code to do osgi refresh:
>>>>
>>>> Bundle systemBundle  = bcx . getBundle ( 0 );
>>>> FrameworkWiring frameworkWiring  = systemBundle . adapt ( FrameworkWiring . class );
>>>> frameworkWiring . refreshBundles ( null );
>>>> (from here  http://stackoverflow.com/a/23361835/5057736 )
>>>>
>>>> This code does the following: it stops and starts bundleA and stops and starts bundleB.
>>>>
>>>> But why bundleA? I am asking because in result bundleA is two times updated. Is this a bug or what?
>>>
>>>The first stop/start is when you do the update, the second is when you
>>>do the refresh. The former is historical, since that is the way update()
>>>was defined in the first version of the spec (I believe). Later versions
>>>of the spec where refreshing was introduced didn't change this behavior
>>>for backward compatibility reasons.
>>>
>>>If refresh were there from the beginning, then it would have likely been
>>>better to have update() simply prepare the updated version and refresh
>>>enact it.
>>>
>>>-> richard
>>>
>>>>
>>>> Best regards, Alex
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail:  users-unsubscribe@felix.apache.org
>>>For additional commands, e-mail:  users-help@felix.apache.org
>>>
>>
>>
>> --
>> Alex Sviridov
>
>
>
>-- 
>Karl Pauls
>karlpauls@gmail.com


-- 
Alex Sviridov

Re: Felix: bundle double update with osgi refresh

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 5/12/17 07:38 , Karl Pauls wrote:
>> For example I have a running osgi framework with two bundles: bundleA and bundleB
>> which jars are in JARS folder. BundleB depends on BundleA. Now I replace bundleA jar
>> in JARS folder.
>>
>> Is there any way to refresh framework (there is new version of bundleA in JARS folder)
>> and not to start/stop bundleA twice?
> Yes, you basically don't just update() but call stop() then update()
> and finally start() on bundleA again.

Yes, that's what I was going to say, but what Karl really meant was 
stop, update, refresh, then start on bundle A.

It's the only way.

-> richard

> regards,
>
> Karl
>
>> Best regards, Alex
>>
>>
>>> Среда, 10 мая 2017, 16:55 +03:00 от "Richard S. Hall" <he...@ungoverned.org>:
>>>
>>> On 5/10/17 08:16 , Alex Sviridov wrote:
>>>> Hi all
>>>>
>>>> I use Apache Felix 5.4.0 and I have two bundles: bundleA and bundleB. BundleB depends on bundleA.
>>>>
>>>> I update bundleA and after that run the following code to do osgi refresh:
>>>>
>>>> Bundle systemBundle  = bcx . getBundle ( 0 );
>>>> FrameworkWiring frameworkWiring  = systemBundle . adapt ( FrameworkWiring . class );
>>>> frameworkWiring . refreshBundles ( null );
>>>> (from here  http://stackoverflow.com/a/23361835/5057736 )
>>>>
>>>> This code does the following: it stops and starts bundleA and stops and starts bundleB.
>>>>
>>>> But why bundleA? I am asking because in result bundleA is two times updated. Is this a bug or what?
>>> The first stop/start is when you do the update, the second is when you
>>> do the refresh. The former is historical, since that is the way update()
>>> was defined in the first version of the spec (I believe). Later versions
>>> of the spec where refreshing was introduced didn't change this behavior
>>> for backward compatibility reasons.
>>>
>>> If refresh were there from the beginning, then it would have likely been
>>> better to have update() simply prepare the updated version and refresh
>>> enact it.
>>>
>>> -> richard
>>>
>>>> Best regards, Alex
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:  users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail:  users-help@felix.apache.org
>>>
>>
>> --
>> Alex Sviridov
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Re[2]: Felix: bundle double update with osgi refresh

Posted by Karl Pauls <ka...@gmail.com>.
> For example I have a running osgi framework with two bundles: bundleA and bundleB
> which jars are in JARS folder. BundleB depends on BundleA. Now I replace bundleA jar
> in JARS folder.
>
> Is there any way to refresh framework (there is new version of bundleA in JARS folder)
> and not to start/stop bundleA twice?

Yes, you basically don't just update() but call stop() then update()
and finally start() on bundleA again.

regards,

Karl

> Best regards, Alex
>
>
>>Среда, 10 мая 2017, 16:55 +03:00 от "Richard S. Hall" <he...@ungoverned.org>:
>>
>>On 5/10/17 08:16 , Alex Sviridov wrote:
>>> Hi all
>>>
>>> I use Apache Felix 5.4.0 and I have two bundles: bundleA and bundleB. BundleB depends on bundleA.
>>>
>>> I update bundleA and after that run the following code to do osgi refresh:
>>>
>>> Bundle systemBundle  = bcx . getBundle ( 0 );
>>> FrameworkWiring frameworkWiring  = systemBundle . adapt ( FrameworkWiring . class );
>>> frameworkWiring . refreshBundles ( null );
>>> (from here  http://stackoverflow.com/a/23361835/5057736 )
>>>
>>> This code does the following: it stops and starts bundleA and stops and starts bundleB.
>>>
>>> But why bundleA? I am asking because in result bundleA is two times updated. Is this a bug or what?
>>
>>The first stop/start is when you do the update, the second is when you
>>do the refresh. The former is historical, since that is the way update()
>>was defined in the first version of the spec (I believe). Later versions
>>of the spec where refreshing was introduced didn't change this behavior
>>for backward compatibility reasons.
>>
>>If refresh were there from the beginning, then it would have likely been
>>better to have update() simply prepare the updated version and refresh
>>enact it.
>>
>>-> richard
>>
>>>
>>> Best regards, Alex
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail:  users-unsubscribe@felix.apache.org
>>For additional commands, e-mail:  users-help@felix.apache.org
>>
>
>
> --
> Alex Sviridov



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org