- private void initWebServer() {
- String httpPort = getFrameworkProp("org.osgi.service.http.port");
- String httpsPort = getFrameworkProp("org.osgi.service.http.port.secure");
- try {
- if (httpPort != null || httpsPort != null) {
- final Hashtable<String, Object> jettyProps = new Hashtable<String, Object>();
- if (httpPort != null) {
- jettyProps.put(JettyConstants.HTTP_PORT, httpPort);
- jettyProps.put(JettyConstants.HTTP_ENABLED, true);
- }
- if (httpsPort != null) {
- jettyProps.put(JettyConstants.HTTPS_PORT, httpsPort);
- jettyProps.put(JettyConstants.HTTPS_ENABLED, true);
- jettyProps.put(JettyConstants.SSL_KEYSTORETYPE, "PKCS12");
- // jettyProps.put(JettyConstants.SSL_KEYSTORE,
- // nodeSecurity.getHttpServerKeyStore().getCanonicalPath());
- jettyProps.put(JettyConstants.SSL_PASSWORD, "changeit");
- jettyProps.put(JettyConstants.SSL_WANTCLIENTAUTH, true);
- }
- if (configurationAdmin != null) {
- // TODO make filter more generic
- String filter = "(" + JettyConstants.HTTP_PORT + "=" + httpPort + ")";
- if (configurationAdmin.listConfigurations(filter) != null)
- return;
- Configuration jettyConf = configurationAdmin
- .createFactoryConfiguration(KernelConstants.JETTY_FACTORY_PID, null);
- jettyConf.update(jettyProps);
-
- } else {
- JettyConfigurator.startServer("default", jettyProps);
- }
+ /** Apply shutdown hoos in reverse order. */
+ private void applyStopHooks() {
+ for (int i = stopHooks.size() - 1; i >= 0; i--) {
+ try {
+ stopHooks.get(i).run();
+ } catch (Exception e) {
+ log.error("Could not run shutdown hook #" + i);