Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Question on programatic close of the runtime

Hi all,

 

I would like to expose the functionality to close the Equinox runtime via an HTTP request. Therefore I have implemented a Jetty ContextHandler as an DeclarativeService. I used the FrameworkCommandProvider as an example on how to close the runtime, but I was not able to get access to the Framework class to call method close() on it.

 

I came up with a workaround for that, which is basically like this:

 

Bundle bundle = _componentContext.getBundleContext().getBundle(0);

if (bundle.getState() == Bundle.ACTIVE) {

bundle.stop();

 while (bundle.getState() != Bundle.RESOLVED) {

                // WAIT N milliseconds and REPEAT at most M times

 }

}

 System.exit(0);

 

 

This works fine for me, although it seems to be a hack stopping bundle with Id 0. Are there better ways to achieve my goal ? Are there any ways to get access to the Framework class ?

 

 

Bye,

Daniel


Back to the top