diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-03-11 11:16:36 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-03-11 11:16:36 +0100 |
commit | 05c48abe473e19f41e7b69be800a2f7efecc1e39 (patch) | |
tree | 3b521851463fc9b9d7cefe0cafe9af2d24defef0 /controller-server | |
parent | 54716d43d3beb5dfb2b04d3f87a30c0fd5e72d4d (diff) |
Wait for maintainers to complete shut down
Diffstat (limited to 'controller-server')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Maintainer.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Maintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Maintainer.java index a814f62cb03..cec44c5d3a0 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Maintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/Maintainer.java @@ -76,14 +76,23 @@ public abstract class Maintainer extends AbstractComponent implements Runnable { // another controller instance is running this job at the moment; ok } catch (Throwable t) { - log.log(Level.WARNING, "Maintainer " + this.getClass().getSimpleName() + " failed. Will retry in " + + log.log(Level.WARNING, "Maintainer " + name() + " failed. Will retry in " + maintenanceInterval + ": " + Exceptions.toMessageString(t)); } } @Override public void deconstruct() { - this.service.shutdown(); + var timeout = Duration.ofSeconds(30); + service.shutdown(); + try { + if (!service.awaitTermination(timeout.toMillis(), TimeUnit.MILLISECONDS)) { + log.log(Level.WARNING, "Maintainer " + name() + " failed to shutdown " + + "within " + timeout); + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } /** Called once each time this maintenance job should run */ |