ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbeerbo...@apache.org
Subject ambari git commit: AMBARI-12262 - ConcurrentModificationException during add host to config group (tbeerbower)
Date Thu, 02 Jul 2015 21:54:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 295b1ec8a -> 369637ab4


AMBARI-12262 - ConcurrentModificationException during add host to config group (tbeerbower)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/369637ab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/369637ab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/369637ab

Branch: refs/heads/branch-2.1
Commit: 369637ab43b19319dd579a60e0c5a778d9bd0ba5
Parents: 295b1ec
Author: tbeerbower <tbeerbower@hortonworks.com>
Authored: Thu Jul 2 17:53:14 2015 -0400
Committer: tbeerbower <tbeerbower@hortonworks.com>
Committed: Thu Jul 2 17:54:15 2015 -0400

----------------------------------------------------------------------
 .../server/state/configgroup/ConfigGroupImpl.java    | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/369637ab/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index f347eb6..a01f4d4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -365,7 +365,6 @@ public class ConfigGroupImpl implements ConfigGroup {
     if (isPersisted) {
       // Delete existing mappings and create new ones
       configGroupHostMappingDAO.removeAllByGroup(configGroupEntity.getGroupId());
-      configGroupDAO.refresh(configGroupEntity);
       configGroupEntity.setConfigGroupHostMappingEntities(new HashSet<ConfigGroupHostMappingEntity>());
     }
 
@@ -402,7 +401,6 @@ public class ConfigGroupImpl implements ConfigGroup {
   void persistConfigMapping(ClusterEntity clusterEntity) {
     if (isPersisted) {
       configGroupConfigMappingDAO.removeAllByGroup(configGroupEntity.getGroupId());
-      configGroupDAO.refresh(configGroupEntity);
       configGroupEntity.setConfigGroupConfigMappingEntities(new HashSet<ConfigGroupConfigMappingEntity>());
     }
 
@@ -452,17 +450,18 @@ public class ConfigGroupImpl implements ConfigGroup {
     }
   }
 
-  @Transactional
   void saveIfPersisted() {
-    ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());
-
     if (isPersisted) {
-      configGroupEntity = configGroupDAO.merge(configGroupEntity);
-      persistHostMapping();
-      persistConfigMapping(clusterEntity);
+      save(clusterDAO.findById(cluster.getClusterId()));
     }
   }
 
+  @Transactional
+  private void save(ClusterEntity clusterEntity) {
+    persistHostMapping();
+    persistConfigMapping(clusterEntity);
+  }
+
   @Override
   @Transactional
   public void delete() {


Mime
View raw message