Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » hot swapping Bundles in equinox(hot swapping Bundles in equinox - restore session variables)
hot swapping Bundles in equinox [message #527304] Wed, 14 April 2010 18:07 Go to next message
arnold4sho  is currently offline arnold4sho Friend
Messages: 2
Registered: April 2010
Junior Member
I have a couple of bundles running on equinox, the bundles are working properly and different bundle versions can be swapped in and out during runtime.

I want to know if it is possible to be able to swap bundles of different versions during runtime and still be able to restore some of the variables in the old bundles that have swapped out and set them in the new bundle.

I know eclipse itself has that possibility. I was just wondering how it is done in an environment containing a few bundles.. is it done by serialization of classes or other means. Maybe if you can refer me to an example, that would be totally great..

Thank You

Arnold
Re: hot swapping Bundles in equinox [message #527305 is a reply to message #527304] Wed, 14 April 2010 18:25 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
There is no built-in facility to do that. Your bundle would have to persist any state it wants preserved on stop and then read in that state on start.

I'm not sure what you mean by by eclipse itself has that possibility. If you are referring to hot swapping code when you change it in your workspace, that is a different mechanism altogether and not related to Equinox or OSGi. Instead that is the debugging agent in the VM swapping out the Class at runtime and preserving the state of the class and its objects.

HTH

Tom.
Re: hot swapping Bundles in equinox [message #527323 is a reply to message #527305] Wed, 14 April 2010 20:07 Go to previous messageGo to next message
arnold4sho  is currently offline arnold4sho Friend
Messages: 2
Registered: April 2010
Junior Member
Thank you for your answer Tom. I though eclipse had that functionality because sometimes when i update or install bundles, i have the option to restart eclipse or to just apply the changes without a restart. Thats why i thought, the bundle swaps preserve the context variables. Do you know of any tools that can provide that functionality of preserving and restoring context variables in osgi?

From what you said, it seems i have to serialize all the classes i want to preserve and then deserialize them.

Thanks

Arnold
Re: hot swapping Bundles in equinox [message #527498 is a reply to message #527323] Thu, 15 April 2010 13:20 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
You don't necessarily have to serialize the classes, just the data that you want to preserve (Class serialization is one way to do that). There is nothing OSGi specific that I know of to do this. The trick in OSGi is finding a place to store that data from one version of your bundle to another.

Typically this is done by getting a file from the data area of your bundle (BundleContext.getDataFile(String)). This area will be preserved from one version of your bundle to the next as long as you use Bundle.update() methods to update the content of your bundle. Unfortunately there are plenty of provisioning agents that do not use the update() method to update from one bundle to the next (p2 is one of them as well as old eclipse update). These provisioning agents uninstall the old bundle and install the new version of the bundle. This obtains a completely new data area for the new version of the bundle.

In eclipse most of the bundles use what we call the "instance area" to persistently store data. For example, project preferences etc. See Eclipse help for the term "Locations" for more information on where your bundle can store information in Equinox.

HTH

Tom.
Previous Topic:p2 director doesn't install binaries
Next Topic:How to install IUs without feature/p2 metadata into a p2 repository?
Goto Forum:
  


Current Time: Thu Apr 25 23:33:40 GMT 2024

Powered by FUDForum. Page generated in 0.03623 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top