[osgi-dev] Restart OSGi framework programatically

Felix Meschberger fmeschbe at gmail.com
Wed Jun 8 11:43:26 EDT 2011


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




More information about the osgi-dev mailing list