Bugfixed ThreadPool awaitTermination call in ManeuverAndWindImporter

This commit is contained in:
Vladislav Chumak
2019-02-21 10:09:17 +01:00
parent 90b920e190
commit 6e2e3dd6f5
2 changed files with 6 additions and 3 deletions
@@ -141,8 +141,8 @@ public class ManeuverAndWindImporter {
+ Math.round(100.0 * i / numberOfRegattas) + "%): \"" + regattaName + "\"");
importRegatta(regattaName, importStatistics);
}
boolean success = executorService.awaitTermination(24, TimeUnit.HOURS);
executorService.shutdown();
boolean success = executorService.awaitTermination(2, TimeUnit.HOURS);
if (success) {
LoggingUtil.logInfo("Import finished");
synchronized (importStatistics) {
@@ -150,7 +150,7 @@ public class ManeuverAndWindImporter {
logImportStatistics(importStatistics);
}
} else {
LoggingUtil.logInfo("Process was terminated");
new InterruptedException("Thread-pool was terminated after two hours waiting time");
}
}
@@ -109,7 +109,10 @@ public class SimpleModelsTraining {
private static void awaitThreadPoolCompletion() throws InterruptedException {
executorService.shutdown();
executorService.awaitTermination(24, TimeUnit.HOURS);
boolean success = executorService.awaitTermination(2, TimeUnit.HOURS);
if (!success) {
new InterruptedException("Thread-pool was terminated after two hours waiting time");
}
Thread.sleep(1000L);
}