Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » How to shutdown an Equinox program ?
How to shutdown an Equinox program ? [message #103818] Mon, 14 January 2008 08:24 Go to next message
Mickael GAUVIN is currently offline Mickael GAUVINFriend
Messages: 38
Registered: July 2009
Member
Hello,

What is the best practice to correctly shut down the application ?
May be call the "stop" method on the "system bundle" ?

In fact I would like all my bundle to be aware of the application endding.

Any suggestion will be appreciated.

Mickael.
Re: How to shutdown an Equinox program ? [message #103832 is a reply to message #103818] Mon, 14 January 2008 14:28 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 437
Registered: July 2009
Senior Member
By "application" I assume you mean an Eclipse application provided by an
extension to the org.eclipse.core.runtime.applications extension point.

Since Eclipse 3.3.0 the Eclipse application container has implemented
Application Admin specification of OSGi which allows it to be better
integrated into the OSGi lifecycle. Before Eclipse 3.3 the Eclipse
application container was not aware of the OSGi lifecycle. The only way
to shutdown the application was to have the application itself return
from its run() method on IPlatformRunnable. At that point the framework
would be shutdown.

In 3.3 the application container introduced the IApplication interface
which allows for an application to be asked to stop. This allowed us to
plug the Eclipse application container into the OSGi lifecycle. This
will give you the following options for shutting down the platform

1) Application controls shutdown. This is the same as in pre-3.3
Eclipse. When the default application returns from its
IApplication#start method then the framework is shutdown.

2) Call system bundle stop() method. The application container will
recognize this and cause the running applications to stop and then the
framework will continue to shutdown.

3) Get the ApplicationHandle OSGi service for the running default
application and call the ApplicationHandle#destroy. This will cause the
default application to stop. When the defautl application returns from
its IApplication#start method then the framework is shutdown.

In all cases when the framework is shutdown all active bundles are
stopped which allows them to run clean up code before the framework
completely shuts down.

HTH

Tom.
Re: How to shutdown an Equinox program ? [message #103846 is a reply to message #103832] Mon, 14 January 2008 15:28 Go to previous message
Mickael GAUVIN is currently offline Mickael GAUVINFriend
Messages: 38
Registered: July 2009
Member
Hello Tom,

Thank you for all these explanations. Now I have a good overview on the
different possibilities to shut down my application.

Mickaël.

Tom Watson a écrit :
> By "application" I assume you mean an Eclipse application provided by an
> extension to the org.eclipse.core.runtime.applications extension point.
>
> Since Eclipse 3.3.0 the Eclipse application container has implemented
> Application Admin specification of OSGi which allows it to be better
> integrated into the OSGi lifecycle. Before Eclipse 3.3 the Eclipse
> application container was not aware of the OSGi lifecycle. The only way
> to shutdown the application was to have the application itself return
> from its run() method on IPlatformRunnable. At that point the framework
> would be shutdown.
>
> In 3.3 the application container introduced the IApplication interface
> which allows for an application to be asked to stop. This allowed us to
> plug the Eclipse application container into the OSGi lifecycle. This
> will give you the following options for shutting down the platform
>
> 1) Application controls shutdown. This is the same as in pre-3.3
> Eclipse. When the default application returns from its
> IApplication#start method then the framework is shutdown.
>
> 2) Call system bundle stop() method. The application container will
> recognize this and cause the running applications to stop and then the
> framework will continue to shutdown.
>
> 3) Get the ApplicationHandle OSGi service for the running default
> application and call the ApplicationHandle#destroy. This will cause the
> default application to stop. When the defautl application returns from
> its IApplication#start method then the framework is shutdown.
>
> In all cases when the framework is shutdown all active bundles are
> stopped which allows them to run clean up code before the framework
> completely shuts down.
>
> HTH
>
> Tom.
Previous Topic:How are classes loaded when using BundleLoader.addDynamicImportPackage() ?
Next Topic:Equinox Transforms
Goto Forum:
  


Current Time: Thu Dec 18 10:36:37 GMT 2014

Powered by FUDForum. Page generated in 0.01672 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software