diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-06-21 00:55:43 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-06-21 13:11:24 +0400 |
commit | 09b9a9586fe2a3a82d79ea2e7c5f1cbe742c8ac5 (patch) | |
tree | 767dc5884bd130141c7a9752cf6530745194edf6 /plugins/sonar-findbugs-plugin | |
parent | 55b66fedfe1bf5af32f2d0975df663dc26dda87f (diff) | |
download | sonarqube-09b9a9586fe2a3a82d79ea2e7c5f1cbe742c8ac5.tar.gz sonarqube-09b9a9586fe2a3a82d79ea2e7c5f1cbe742c8ac5.zip |
SONAR-2536 Execution of FindBugs should not leave unterminated threads
Diffstat (limited to 'plugins/sonar-findbugs-plugin')
-rw-r--r-- | plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java index 3fed8b0a219..e1e8fd2a482 100644 --- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java +++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java @@ -29,6 +29,7 @@ import java.util.Enumeration; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.Executors; +import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import com.google.common.collect.Lists; @@ -64,6 +65,7 @@ public class FindbugsExecutor implements BatchExtension { Thread.currentThread().setContextClassLoader(FindBugs2.class.getClassLoader()); OutputStream xmlOutput = null; + ExecutorService executorService = Executors.newSingleThreadExecutor(); try { DetectorFactoryCollection detectorFactory = loadFindbugsPlugins(); @@ -99,7 +101,7 @@ public class FindbugsExecutor implements BatchExtension { engine.finishSettings(); - Executors.newSingleThreadExecutor().submit(new FindbugsTask(engine)).get(configuration.getTimeout(), TimeUnit.MILLISECONDS); + executorService.submit(new FindbugsTask(engine)).get(configuration.getTimeout(), TimeUnit.MILLISECONDS); profiler.stop(); @@ -109,6 +111,7 @@ public class FindbugsExecutor implements BatchExtension { } catch (Exception e) { throw new SonarException("Can not execute Findbugs", e); } finally { + executorService.shutdown(); IOUtils.closeQuietly(xmlOutput); Thread.currentThread().setContextClassLoader(initialClassLoader); } |