Take a look at the refreshPackages method of the PackageAdmin service.

Note that the refresh operation is intended to delimit batched
uninstall/update operations by a management agent. For example if you have
10 bundles to uninstall, then do NOT refresh between each bundle, but save
it until all 10 are uninstalled.

This is because refresh can be expensive. In fact the OSGi specification
allows for it to be implemented by the framework shutting itself down and
restarting (though no framework implementation I know of actually does it
that way, fortunately!).

Regards,
Neil

On Thu, Jul 29, 2010 at 1:04 PM, Andrea Zoppello <[email protected]>wrote:

>  Hi Tom,
>
> Thx for the clarification, now it's clear to me the reason of that :).
>
> Is there a way to do a refresh using the "lifecycle API"??
>
> Andrea
> Il 29/07/2010 13:45, Thomas Watson ha scritto:
>
> Yes a refresh is needed. The OSGi framework must keep the content of "A"
> around on uninstall if another bundle is using (wired) to one of "A"s
> exported packages. So in your case "B" is still allowed to remain resolved
> and in fact will still be able to load any classes from packages it imports
> from "A". When you do a refresh you are telling the framework to flush the
> removal pending bundles which forces any bundles depending on the removal
> pending bundle to be re-resolved.
>
> This behavior seems odd at first but the goal is to allow staged updates
> and uninstalls that do not disturb other bundles in the system until all the
> updates and uninstalls are done and the management agent wants to do a
> controlled refresh of the system.
>
> Tom
>
>
>
> [image: Inactive hide details for Andrea Zoppello ---07/29/2010 05:42:11
> AM---Hi All,]Andrea Zoppello ---07/29/2010 05:42:11 AM---Hi All,
>
>
> From:
> Andrea Zoppello <[email protected]> <[email protected]>
> To:
> OSGi - Dev <[email protected]> <[email protected]>
> Date:
> 07/29/2010 05:42 AM
> Subject:
> [osgi-dev] A question about UNINSTALL Operation...
>
> ------------------------------
>
>
>
> Hi All,
>
> I've a question about uninstalling bundles.
>
> Suppose i've a simple situation where i've two bunldes "A" and "B" and
> B is importing some packages from bundle "A".
>
> My doubt is about "what should" happens to the state of  "B" when i'm going
> to uninstall bundle "A".
>
> I was ( wrongly ) thinking that the container had automatically  put B in
> "INSTALLED" state, because A was uninstalled.
>
> But i discovered that this would not happen ( at least with equinox) until
> i
> do a refresh???
>
> So the question is, which is the right behaviour of the OSGi container
> in that case??
> Should i need a refresh anyway??
>
> Thx
> Andrea
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
>
> _______________________________________________
> OSGi Developer Mail 
> [email protected]https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to