From: Duarte Meneses Date: Wed, 6 Jan 2016 13:17:53 +0000 (+0100) Subject: SONAR-7121 Project's File Lock not released on error X-Git-Tag: 5.4-M4~31 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=14fde3c0c46e717ac44a0b482f21f82149e2e837;p=sonarqube.git SONAR-7121 Project's File Lock not released on error --- diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java index 63485f49f08..da67178b802 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java @@ -99,6 +99,7 @@ public class ProjectScanContainer extends ComponentContainer { private static final Logger LOG = Loggers.get(ProjectScanContainer.class); private final AnalysisProperties props; + private ProjectLock lock; public ProjectScanContainer(ComponentContainer globalContainer, AnalysisProperties props) { super(globalContainer); @@ -108,7 +109,8 @@ public class ProjectScanContainer extends ComponentContainer { @Override protected void doBeforeStart() { addBatchComponents(); - getComponentByType(ProjectLock.class).tryLock(); + lock = getComponentByType(ProjectLock.class); + lock.tryLock(); addBatchExtensions(); Settings settings = getComponentByType(Settings.class); if (settings != null && settings.getBoolean(CoreProperties.PROFILING_LOG_PROPERTY)) { @@ -125,7 +127,6 @@ public class ProjectScanContainer extends ComponentContainer { return super.startComponents(); } catch (Exception e) { // ensure that lock is released - ProjectLock lock = getComponentByType(ProjectLock.class); if (lock != null) { lock.stop(); }