felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Sviridov <ooo_satu...@mail.ru.INVALID>
Subject Re[2]: Felix: bundle double update with osgi refresh
Date Sat, 13 May 2017 12:15:25 GMT
Thank you. Now it is working as expected.

Суббота, 13 мая 2017, 13:07 +03:00 от Karl Pauls <karlpauls@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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message