|
Re: Shutting down the OSGi framework [message #896503 is a reply to message #895816] |
Wed, 18 July 2012 15:00 |
|
Hello Kris,
your approach should be definitively correct and it gives all bundles a
change to shutdown gracefully.
See
http://stackoverflow.com/questions/1916432/best-way-to-shutdown-an-osgi-container-specifically-equinox
for broader discussion.
Libor
On 07/16/2012 09:49 AM, Kris Mising name wrote:
> I was looking for some time and could not find any concrete solution for
> how to terminate the OSGi framework in the clean way. I experimented a
> bit and came up with the following solution:
>
>
> final BundleContext bundleContext =
> FrameworkUtil.getBundle(this.getClass()).getBundleContext();
> if ( bundleContext != null ) {
> bundleContext.getBundle(0).stop();
> }
>
>
> Is that a good way of handling the OSGi shutdown or does anyone know a
> better approach?
|
|
|
|
Re: Shutting down the OSGi framework [message #935780 is a reply to message #895816] |
Sun, 07 October 2012 10:01 |
Karl Weber Messages: 63 Registered: September 2010 |
Member |
|
|
O.k. I think I understand my problem a little bit better, but I don't have a solution.
I start the framework with the options
-Declipse.application.launchDefault=false -Declipse.allowAppRelaunch=true
The first option ensures, that no application is started automatically. This works, the main thread is indeed waiting and I have to launch my application manually.
The second option ensures, that Quote: the main thread will continue to wait for another application descriptor to be launched after the currently running application has quit. Stopping the system.bundle (i.e. the bundle with a bundle ID equel to zero) will force the main thread to stop waiting for another application to launch
This, however, does not work. The main thread keeps on waiting forever after the first application stopped and I calledbundleContext.getBundle(0).stop();
The only proof I have is that once I set this option to false, everything works, i.e. the main thread stops after the first application quit, and the framework stops after callingbundleContext.getBundle(0).stop();
Unfortunately this will prevent me from launching another application after my first application quit.
My current understanding is, that this is a bug, or am I missing something else?
|
|
|
Powered by
FUDForum. Page generated in 0.03267 seconds