Hello everyone

I created a little executable-jar which launches Felix. After some 
computation has been done the framework is shutdown by using 
context.getBundle(0).stop()

This however always throws an InterruptedException

java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at 
org.apache.felix.framework.util.ThreadGate.await(ThreadGate.java:79)
        at org.apache.felix.framework.Felix.waitForStop(Felix.java:1068)
        at aQute.launcher.Launcher.deactivate(Launcher.java:738)
        at aQute.launcher.Launcher.run(Launcher.java:287)
        at aQute.launcher.Launcher.main(Launcher.java:87)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at 
aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:38)

My only guess is, that this has something to do with the way I execute my 
code: I use an @Activate method which runs some code and shuts down the 
framework before it completes

        @Activate
        void activate(ComponentContext ctx){
                this.context = ctx.getBundleContext();
                try{
                        executeGroovy();
                }catch(Throwable t){
                        t.printStackTrace();
                }
 
                String keepAlive = context.getProperty(
"de.sdv.geb.runner.keepAlive");
 
                if(!Boolean.parseBoolean(keepAlive)){
                        try {
                                System.out.println("Shutting down");
                                context.getBundle(0).stop();
                        } catch (BundleException e) {
                                System.err.println("Error stopping 
OSGI-Container...killing VM now");
                                e.printStackTrace();
                                // hard way
                                System.exit(1);
                        }
                }
        }

Using Felix 5.2.0 and the executable jar is created with BndTool 3.0.0 
from a run-descriptor.

Any ideas how to get rid of this exceptions?

Thanks
Marc

Reply via email to