summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java
index 7ea6f5f8504..5290dee32bb 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerBootstrap.java
@@ -221,10 +221,9 @@ public class ConfigServerBootstrap extends AbstractComponent implements Runnable
return true;
}
- // Returns the set of applications that failed to redeploy
+ // Returns applications that failed to redeploy
private List<ApplicationId> redeployApplications(List<ApplicationId> applicationIds) throws InterruptedException {
- ExecutorService executor = Executors.newFixedThreadPool(configserverConfig.numRedeploymentThreads(),
- new DaemonThreadFactory("redeploy-apps-"));
+ ExecutorService executor = getExecutor();
log.log(Level.INFO, () -> "Redeploying " + applicationIds.size() + " apps: " + applicationIds);
PreparedApplications preparedApplications = prepare(applicationIds, executor);
@@ -235,13 +234,21 @@ public class ConfigServerBootstrap extends AbstractComponent implements Runnable
List<ApplicationId> failed = activate(preparedApplications.deploymentInfos());
+ shutdownExecutor(executor);
+ return failed;
+ }
+
+ private void shutdownExecutor(ExecutorService executor) throws InterruptedException {
executor.shutdown();
if ( ! executor.awaitTermination(1, TimeUnit.HOURS)) {
log.log(Level.WARNING, "Awaiting termination of executor failed");
executor.shutdownNow();
}
+ }
- return failed;
+ private ExecutorService getExecutor() {
+ return Executors.newFixedThreadPool(configserverConfig.numRedeploymentThreads(),
+ new DaemonThreadFactory("redeploy-apps-"));
}
private PreparedApplications prepare(List<ApplicationId> applicationIds, ExecutorService executor) {