Hi,

you can add a BundleListener and check if the state of the bundle of ID 0.

Anyway it looks weird to me to define some logic at startup. Why not using a bootFeature or a startup bundle ?

Regards
JB

On 05/03/2012 05:28 PM, bobshort 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.

--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to