Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] bundles wiring and redeployment issues - hotswap

To discuss, lets define some package names:

package mybean contains MyBean
package myservice contains MyService

The export for package myservice must have a uses constraint on mybean since a type in mybean appears in the signature of a type in myservice.

Bundle C must import both package mybean and myservice since it uses types from both. When you update the package exporting mybean, you will need to refresh all the bundles which import mybean in order for them to re-resolve to the updated package. So Bundle C must be stopped, re-resolved and restarted. This cannot be avoided.

--

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the
OSGi Alliance
hargrave@xxxxxxxxxx

office: +1 386 848 1781
mobile: +1 386 848 3788






From:        "matteo rulli" <matteo.rulli@xxxxxxxxxxx>
To:        <equinox-dev@xxxxxxxxxxx>,
Date:        2013/01/30 11:47
Subject:        [equinox-dev] bundles wiring and redeployment issues - hotswap
Sent by:        equinox-dev-bounces@xxxxxxxxxxx




I'm facing the following issue under OSGi environment: let's say I have a bundle A exporting com.mybiz.example package. This package, in its 1.0.0 version, contains a bean class MyBean so that
 
    public class MyBean {
     int var;
     public MyBean() { }
     public int getVar() { return var; }
     public void setVar(int v) { var = v; }
    }
 
Bundle B exports an interface MyService which uses MyBean:
 
    public interface MyService {
     public MyBean getMyBean();
    }
 
Note: in our architecture, MyBean must be a class and not an interface.
 
Bundle C uses MyService as a declarative service in this way:
 
    private AtomicReference<MyService> _serv = new AtomicReference<MyService>();
    public void addMyService(MyService serv) {
     //this method is the one called by declarative services when Bundle B is started
     _serv.set(serv);
    }
 
    public void run() {
     ...
     
     MyBean x = _serv.getMyBean();
     //use x ...
    }
 
Now the problem arises if I need to do a hot fix on MyBean class.
Let's say I need to add a field and some methods.
Then, I've got a running OSGi environment where bundles A,B,C are deployed.
 
My requirement is that I cannot stop any bundle.
 
So, under these hypotheses, I deploy a new version of my bundle A, say A_1.1.0.jar. Now I'm not able to make bundle C to use the new version of MyBean class contained in A_1.1.0.jar.
 
How can I do it?
 
Thank you very much!
 
Best regards,
matteo_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top