Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] policies wrt use of Bundle-ActivationPolicy

Unfortunately much of this has to do with how the Eclipse platform is
managed and the policy used to activate bundles when provisioned within an
Eclipse platform installation.  As a general rule, if your bundle does not
provide any OSGi services then it likely can use the lazy activation
policy.  But as soon as you offer any OSGi services, by programmatically
registering them, then using the lazy activation policy becomes a real pain
because it is not easy to have your bundle provide any services until it is
activated.  The only way you can is to use and extender (like OSGi
declarative services) that supports registering services for lazy activated
bundles while they are in the (wait for trigger class load) STARTING state.
But then you are no longer programmatically registering the service,
instead DS is doing it for you.

As a simple rule I would avoid doing that since it has caused us much
confusion when we take this approach.  I just ran into a similar issue
where I had to debug why our coordinator service implementation in equinox
was not registering the Coordinator service.  The bundle was in the "lazy
activation" STARTING state but it was not registering any coodinator
service.  This was because I did not have an active declarative services
(org.eclipse.equinox.ds) implementation.

So I would remove Bundle-ActivationPolicy: lazy from any bundle that is
offering OSGi services that others need to consume unless there is some
scenario where you know for a fact that a "trigger" class load is going to
happen to ensure your bundle will be activated to allow you to
programmatically register your OSGi services.  The issue with removing the
'lazy' activation policy is now you are left with a tricky problem to get
your bundle eagerly activated if/when installed in the Eclipse platform via
p2.

The eclipse builds do this with a .product file (for the Eclipse SDK). See
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.releng.eclipsebuilder/eclipse/buildConfigs/sdk/builder/sdk.product?view=markup

You will notice it has a <configurations/> section where it lists the
bundles that eagerly started (autoStart="true").  I don't fully understand
how all this .product file stuff works.  Any questions you have on that
should be directed at the p2-dev mailing list or forums.

Tom




|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Scott Lewis <slewis@xxxxxxxxxxxxx>                                                                                                                |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Equinox development mailing list <equinox-dev@xxxxxxxxxxx>,                                                                                       |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |03/13/2012 09:50 AM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |[equinox-dev] policies wrt use of Bundle-ActivationPolicy                                                                                         |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





Hi,

ECF has consumers that use our OSGi remote services implementation in
client-server use cases.   Some of these also use other framework impls
(e.g. felix) for the remote service host and/or consumer.

As a plugin to Eclipse, we use Bundle-ActivationPolicy: lazy for
many/most of our bundles...but there are now requests [1] for us to
remove BAP from some of our bundles, in order to facilitate usage in
non-Eclipse use cases.

What are the current policies and/or guidelines for the use (or not) of
BAP within (and/or outside of) Eclipse?

Thanks,

Scott


[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=373475


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev






Back to the top