> Hi, > >>> I need to restart an OSGi application programmatically in Java. How can >>> I do this? >> AFAICT the "official" way is to call Bundle.update() on the system >> bundle. > > > Thanks for all proposals. I "only" need to restart the OSGi Framework, not > the entire JVM. You mentioned a system bundle, do you mean > "org.eclipse.osgi" ? If yes, what's the best way to get the appropriate > reference, iterate over all bundles?
The system bundle has id 0, so (for example) you can call getBundle(0) on the BundleContext. Chris > Eugen > > > Am 09.06.2011 um 10:26 schrieb Felix Meschberger: > >> Hi, >> >> Am Mittwoch, den 08.06.2011, 18:00 +0200 schrieb Guillaume Nodet: >>> Right, we have the same kind of launcher in Karaf that even enable us >>> to update the osgi framework itself. >> >> Ok, lets continue with ads: The Sling launcher can also do this >> supporting the Bundle.update(InputStream) method on the system >> bundle ;-) >> >> Regards >> Felix >> >>> >>> On Wed, Jun 8, 2011 at 17:43, Felix Meschberger <[email protected]> >>> wrote: >>>> Hi, >>>> >>>> Am Mittwoch, den 08.06.2011, 11:34 -0400 schrieb Richard S. Hall: >>>>> On 6/8/11 11:20, Felix Meschberger wrote: >>>>>> Hi, >>>>>> >>>>>> Am Mittwoch, den 08.06.2011, 17:12 +0200 schrieb Eugen Reiswich: >>>>>>> Hi folks, >>>>>>> >>>>>>> I need to restart an OSGi application programmatically in Java. How >>>>>>> can I do this? >>>>>> AFAICT the "official" way is to call Bundle.update() on the system >>>>>> bundle. >>>>> >>>>> True. >>>>> >>>>>> BUT: This requires support from the framework launcher. >>>>> >>>>> Not entirely true. >>>> >>>> Yes, I just realized that I remained in the 4.1 times when Peter >>>> posted >>>> his reply. >>>> >>>>> >>>>> If you want to simply restart the framework, then calling update() on >>>>> the system bundle would be sufficient. However, if you want to >>>>> restart >>>>> the JVM (e.g., to change what's on the boot class path) then you need >>>>> help from the launcher. >>>> >>>> In fact, what we do in the Sling launcher is that we create "root" >>>> class >>>> loader to load the framework with and on framework restart we throw >>>> away >>>> the old one and create a new one. >>>> >>>> I think this further helps PermGen GC --- but I would be happy to >>>> learn >>>> that I am wrong ;-) >>>> >>>> Regards >>>> Felix >>>> >>>> >>>> _______________________________________________ >>>> 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 > > > _______________________________________________ > 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
