aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/ProjectScanContainer.java5
1 files changed, 3 insertions, 2 deletions
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();
}