Use karaf shutdown timeout when notifying the service wrapper in Main
@@ -638,11 +638,13 @@ public class Main {
return true;
}
try {
- int step = 5000;
+ int timeout = config.shutdownTimeout;
+ if (config.shutdownTimeout <= 0) {
+ timeout = Integer.MAX_VALUE;
+ }
- // Notify the callback asap
if (shutdownCallback != null) {
- shutdownCallback.waitingForShutdown(step);
+ shutdownCallback.waitingForShutdown(timeout);
}
exiting = true;
@@ -659,15 +661,9 @@ public class Main {
}.start();
}
- int timeout = config.shutdownTimeout;
- if (config.shutdownTimeout <= 0) {
- timeout = Integer.MAX_VALUE;
- }
+ int step = 5000;
while (timeout > 0) {
timeout -= step;
- if (shutdownCallback != null) {
- shutdownCallback.waitingForShutdown(step * 2);
- }
FrameworkEvent event = framework.waitForStop(step);
if (event.getType() != FrameworkEvent.WAIT_TIMEDOUT) {
if (activatorManager != null) {
