diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java b/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java index 47f533e91..f886ef03a 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java @@ -108,23 +108,27 @@ public class PluginsLoader { } private List processPlugins(List jars) throws Exception { - final List plugins = Lists.newArrayList(); final ExecutorService executorService = Executors.newFixedThreadPool(10); - final CompletionService completionService = new ExecutorCompletionService<>(executorService); - final List> callables = extractJars(jars); + try { + final List plugins = Lists.newArrayList(); + final CompletionService completionService = new ExecutorCompletionService<>(executorService); + final List> callables = extractJars(jars); - for (Callable s : callables) { - completionService.submit(s); - } - int n = callables.size(); - for (int i = 0; i < n; i++) { - Plugin plugin = completionService.take().get(); - if (plugin.getLesson().isPresent()) { - plugins.add(plugin); + for (Callable s : callables) { + completionService.submit(s); } + int n = callables.size(); + for (int i = 0; i < n; i++) { + Plugin plugin = completionService.take().get(); + if (plugin.getLesson().isPresent()) { + plugins.add(plugin); + } + } + LabelProvider.updatePluginResources(pluginTarget.resolve("plugin/i18n/WebGoatLabels.properties")); + return plugins; + } finally { + executorService.shutdown(); } - LabelProvider.updatePluginResources(pluginTarget.resolve("plugin/i18n/WebGoatLabels.properties")); - return plugins; } private List> extractJars(List jars) {