This is an automated email from the ASF dual-hosted git repository.
pauls pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git
The following commit(s) were added to refs/heads/master by this push:
new 9ba0848 Wait for 10 seconds for framework stop on kill.
9ba0848 is described below
commit 9ba0848f5e9b499a3b0ad78dbddc2e8abec0f598
Author: Karl Pauls <[email protected]>
AuthorDate: Tue May 8 16:06:14 2018 +0200
Wait for 10 seconds for framework stop on kill.
---
.../launcher/impl/launchers/FrameworkLauncher.java | 1 +
.../feature/launcher/impl/launchers/FrameworkRunner.java | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git
a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
index ded2239..12a5c66 100644
---
a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
+++
b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkLauncher.java
@@ -98,5 +98,6 @@ public class FrameworkLauncher implements Launcher {
Main.LOG().debug("Startup took: " + (System.currentTimeMillis() -
time));
// nothing else to do, constructor starts everything
+ // TODO: wait for stop and restart framework when necessary
}
}
diff --git
a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
index 5d95cef..f17b6c3 100644
---
a/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
+++
b/src/main/java/org/apache/sling/feature/launcher/impl/launchers/FrameworkRunner.java
@@ -16,7 +16,9 @@
*/
package org.apache.sling.feature.launcher.impl.launchers;
+import org.apache.sling.feature.launcher.impl.Main;
import org.osgi.framework.BundleException;
+import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.launch.Framework;
import org.osgi.framework.launch.FrameworkFactory;
@@ -56,8 +58,18 @@ public class FrameworkRunner extends AbstractRunner {
public void run() {
try {
framework.stop();
- } catch (final BundleException e) {
- // ignore
+ FrameworkEvent waitForStop = framework.waitForStop(10000);
+ if (waitForStop.getType() != FrameworkEvent.STOPPED)
+ {
+ Main.LOG().warn("Framework stopped with: " +
waitForStop.getType(), waitForStop.getThrowable());
+ }
+ else
+ {
+ Main.LOG().info("Framework stopped");
+ }
+ } catch (BundleException | InterruptedException e)
+ {
+ Main.LOG().warn("Exception stopping the framework in
shutdown hook", e);
}
}
});
--
To stop receiving notification emails like this one, please contact
[email protected].