felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@apache.org>
Subject Re: how can a bundle stop itself programmatically?
Date Wed, 19 Oct 2016 10:51:35 GMT
Try stopping / removing the bundle in another thread.

new Thread(new Runnable() {
    final Bundle bundle = bundleContext.getBundle();
    @Override
    public void run() {
        bundle.stop();
    }
}).start();


2016-10-18 14:35 GMT+02:00 sid19039 <sid19039@gmail.com>:

> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message