Merge pull request #132 from nbaars/master

Shutdown threadPools after plugin loading
This commit is contained in:
Doug Morato 2015-10-26 16:48:50 -04:00
commit 10e2b044e9

View File

@ -108,8 +108,9 @@ public class PluginsLoader {
} }
private List<Plugin> processPlugins(List<URL> jars) throws Exception { private List<Plugin> processPlugins(List<URL> jars) throws Exception {
final List<Plugin> plugins = Lists.newArrayList();
final ExecutorService executorService = Executors.newFixedThreadPool(10); final ExecutorService executorService = Executors.newFixedThreadPool(10);
try {
final List<Plugin> plugins = Lists.newArrayList();
final CompletionService<Plugin> completionService = new ExecutorCompletionService<>(executorService); final CompletionService<Plugin> completionService = new ExecutorCompletionService<>(executorService);
final List<Callable<Plugin>> callables = extractJars(jars); final List<Callable<Plugin>> callables = extractJars(jars);
@ -125,6 +126,9 @@ public class PluginsLoader {
} }
LabelProvider.updatePluginResources(pluginTarget.resolve("plugin/i18n/WebGoatLabels.properties")); LabelProvider.updatePluginResources(pluginTarget.resolve("plugin/i18n/WebGoatLabels.properties"));
return plugins; return plugins;
} finally {
executorService.shutdown();
}
} }
private List<Callable<Plugin>> extractJars(List<URL> jars) { private List<Callable<Plugin>> extractJars(List<URL> jars) {