There's no such thing as a 'started' state.  The osgi framework is fully
asynchronous and things can even be done on behalf of other bundles.  The
only real way to know if 'something' is started is to have this thing
register an osgi service when started and wait for this service to be
registered.  A lot of bundles do behave in this way so that you have
inter-bundles dependencies using services.  But at the end, 'started'
depends on what meaning you put behind this word, and that mostly depends
on what you deploy.

On Thu, May 3, 2012 at 5:28 PM, bobshort <jer...@check-it.ca> wrote:

> We have bundles that do some intensive processing. Right now they are
> starting as the framework is starting and slowing startup down
> considerably.
> The osgi container is running on a plug computer so resources are minimal.
>
> I want to start my processing only after the osgi container is fully
> started. I've implemented a framework listener to detect when the framework
> is started and then trigger my startup logic:
>
> /public class EventListener implements FrameworkListener {
>
>        @Override
>        public void frameworkEvent(FrameworkEvent event) {
>                if (event.getType() == FrameworkEvent.STARTED) {
>                        // Do startup logic here.
>                }
>        }
> }/
>
> This works if my bundles are installed before the framework is started, but
> it obviously does not work for modules installed after the framework is
> started.
>
> Is there any way I can query the framework status from my bundle so I can
> detect if the container is already fully started when the bundle is
> installed? I'd like to do something like:
>
> /
>        public void onBundleStarted() {
>                if (**test if framework already running**) {
>                        // Do startup logic here.
>                }
>        }
> /
>
> Is this possible?
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Is-there-a-way-to-query-osgi-framework-status-e-g-started-tp3959588.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
FuseSource, Integration everywhere
http://fusesource.com

Reply via email to