aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-02-12 09:28:32 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-02-12 09:28:32 +0100
commit372cab29ac3ee6afb5615141e11c96ad1cb6540e (patch)
tree9f8edd6403e08fcd8a0d3a7f7d1431d2098adce1
parentd41d216c069d4144def36514be7c290f4706c116 (diff)
parent9b6a8ecd0475b2f4035ce29c04387b7fff9970b6 (diff)
downloadsonarqube-372cab29ac3ee6afb5615141e11c96ad1cb6540e.tar.gz
sonarqube-372cab29ac3ee6afb5615141e11c96ad1cb6540e.zip
Merge remote-tracking branch 'origin/branch-5.0' into fix/merge-5.0
* origin/branch-5.0: SONAR-6130 fix deadlock during purge Conflicts: sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java
-rw-r--r--sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
index 0e507c10dd6..6af3a526fcd 100644
--- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java
@@ -32,10 +32,7 @@ import org.sonar.core.persistence.MyBatis;
import org.sonar.core.resource.ResourceDao;
import org.sonar.core.resource.ResourceDto;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
import static org.sonar.api.utils.DateUtils.dateToLong;
@@ -133,16 +130,22 @@ public class PurgeDao {
}
private void disableOrphanResources(final ResourceDto project, final SqlSession session, final PurgeMapper purgeMapper, final PurgeListener purgeListener) {
+ final List<IdUuidPair> componentIdUuids = new ArrayList<IdUuidPair>();
session.select("org.sonar.core.purge.PurgeMapper.selectComponentIdUuidsToDisable", project.getId(), new ResultHandler() {
@Override
public void handleResult(ResultContext resultContext) {
IdUuidPair componentIdUuid = (IdUuidPair) resultContext.getResultObject();
if (componentIdUuid.getId() != null) {
- disableResource(componentIdUuid, purgeMapper);
- purgeListener.onComponentDisabling(componentIdUuid.getUuid());
+ componentIdUuids.add(componentIdUuid);
}
}
});
+
+ for (IdUuidPair componentIdUuid : componentIdUuids) {
+ disableResource(componentIdUuid, purgeMapper);
+ purgeListener.onComponentDisabling(componentIdUuid.getUuid());
+ }
+
session.commit();
}