aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-12-16 14:37:26 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-12-16 14:37:26 +0000
commit4b756e42a163a02f2bf29dca930295cfd3c5f0ea (patch)
treee84f9f32ee08d33ff9c844d5b857bca08ad75545 /sonar-server/src
parentca75da099a891bdc4fd4e2249deaedb0da2effc8 (diff)
downloadsonarqube-4b756e42a163a02f2bf29dca930295cfd3c5f0ea.tar.gz
sonarqube-4b756e42a163a02f2bf29dca930295cfd3c5f0ea.zip
fix memory leak : hibernate session is not correctly cleared with batch processing mode
Diffstat (limited to 'sonar-server/src')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java3
-rw-r--r--sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java10
2 files changed, 4 insertions, 9 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java
index 144e813f370..99af8cfc275 100644
--- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java
+++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterProvidedProfiles.java
@@ -68,6 +68,7 @@ public final class RegisterProvidedProfiles {
DatabaseSession session = sessionFactory.getSession();
cleanProvidedProfiles(profiles, session);
saveProvidedProfiles(profiles, session);
+ session.commit();
profiler.stop();
}
@@ -108,7 +109,6 @@ public final class RegisterProvidedProfiles {
existingProfile.setActiveRules(new ArrayList<ActiveRule>());
session.saveWithoutFlush(existingProfile);
}
- session.commit();
}
profiler.stop();
}
@@ -130,7 +130,6 @@ public final class RegisterProvidedProfiles {
}
session.saveWithoutFlush(persistedProfile);
- session.commit();
profiler.stop();
}
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java
index c222152667c..6f01506b6bc 100644
--- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java
+++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterRules.java
@@ -64,6 +64,8 @@ public final class RegisterRules {
profiler.start("Disable deprecated active rules");
deleteDisabledActiveRules(session);
profiler.stop();
+
+ session.commit();
}
private void disableDeprecatedUserRules(DatabaseSession session) {
@@ -81,12 +83,11 @@ public final class RegisterRules {
rule.setEnabled(false);
session.saveWithoutFlush(rule);
}
- session.commit();
+
}
private void disableAllRules(DatabaseSession session) {
session.createQuery("UPDATE " + Rule.class.getSimpleName() + " SET enabled=false WHERE parent IS NULL").executeUpdate();
- session.commit();
}
private void registerRepository(RuleRepository repository, DatabaseSession session) {
@@ -107,7 +108,6 @@ public final class RegisterRules {
}
saveNewRules(rulesByKey.values(), session);
- session.commit();
}
private void deleteDisabledActiveRules(DatabaseSession session) {
@@ -118,9 +118,6 @@ public final class RegisterRules {
for (ActiveRule deprecatedActiveRule : deprecatedActiveRules) {
session.removeWithoutFlush(deprecatedActiveRule);
}
- if (!deprecatedActiveRules.isEmpty()) {
- session.commit();
- }
}
private void updateRule(Rule persistedRule, Rule rule, DatabaseSession session) {
@@ -173,6 +170,5 @@ public final class RegisterRules {
rule.setEnabled(true);
session.saveWithoutFlush(rule);
}
- session.commit();
}
}