This is probably not a very good approach. Generally you should let some bundle agent be responsible for the states of bundles.
Perhaps explaining your use case could help us suggest a better alternative. Sincerely, - Ray On Tue, Oct 18, 2016 at 8:35 AM, sid19039 <[email protected]> wrote: > Hello All, > > I have trying to stop a bundle from within itself by invoking stop method > as > following in its Activator's start method: > bundleContext.getBundle().stop(); > > But post this statement is executed, when i check its state via "lb" > command > on felix shell, its state is shown as Active. > Then when i try to stop it via stop <bundleid> command, an exception is > thrown that > *org.osgi.framework.BundleException: Stopping a starting or stopping > bundle > is currently not supported.*And then its state is shown as *stopping* > > Please someone tell how i can achieve this.. > > Regards > Siddharth > > > > > -- > View this message in context: http://apache-felix.18485.x6. > nabble.com/how-can-a-bundle-stop-itself-programmatically-tp5018885.html > Sent from the Apache Felix - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile> (@rotty3000) Senior Software Architect *Liferay, Inc.* <http://www.liferay.com> (@Liferay) Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

