Michael Kublin has uploaded a new change for review.

Change subject: engine: Fixing possible ConcurrentModificationException at 
ResourceManager
......................................................................

engine: Fixing possible ConcurrentModificationException at ResourceManager

1. _vdsAndVmsList - is shared map and can be changed by different hosts, the 
exception can
occurre during remove of different hosts
2. patch also contains some simple cleaning

Change-Id: Id67567ccabb65c73499cbae7d0a179afe6d88244
Signed-off-by: Michael Kublin <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/ResourceManager.java
1 file changed, 3 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/9702/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/ResourceManager.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/ResourceManager.java
index fa04c0e..559f9f7 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/ResourceManager.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/ResourceManager.java
@@ -1,8 +1,6 @@
 package org.ovirt.engine.core.vdsbroker;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -43,7 +41,7 @@
 public class ResourceManager {
 
     private static ResourceManager _Instance = new ResourceManager();
-    private final Map<Guid, HashSet<Guid>> _vdsAndVmsList = new HashMap<Guid, 
HashSet<Guid>>();
+    private final Map<Guid, HashSet<Guid>> _vdsAndVmsList = new 
ConcurrentHashMap<Guid, HashSet<Guid>>();
     private final Map<Guid, VdsManager> _vdsManagersDict = new 
ConcurrentHashMap<Guid, VdsManager>();
     private final ConcurrentHashMap<Guid, Boolean> _asyncRunningVms =
             new ConcurrentHashMap<Guid, Boolean>();
@@ -231,13 +229,6 @@
         }
     }
 
-    public void SetVmDown(VM vm) {
-        RemoveAsyncRunningVm(vm.getId());
-        InternalSetVmStatus(vm, VMStatus.Down);
-        storeVm(vm);
-
-    }
-
     public boolean IsVmDuringInitiating(Guid vm_guid) {
         return _asyncRunningVms.containsKey(vm_guid);
     }
@@ -330,16 +321,13 @@
             if (constructor != null) {
                 return constructor.newInstance(new Object[] { parameters });
             }
-        } catch (InvocationTargetException e) {
+        } catch (Exception e) {
             if (e.getCause() != null) {
                 log.debug("CreateCommand failed", e.getCause());
                 throw new RuntimeException(e.getCause().getMessage(), 
e.getCause());
             }
             log.debug("CreateCommand failed", e);
-        } catch (java.lang.Exception e) {
-            log.debug("CreateCommand failed", e);
         }
-
         return null;
     }
 
@@ -355,16 +343,13 @@
             if (constructor != null) {
                 return constructor.newInstance(new Object[] { parameters });
             }
-        } catch (InvocationTargetException e) {
+        } catch (Exception e) {
             if (e.getCause() != null) {
                 log.debug("CreateCommand failed", e.getCause());
                 throw new RuntimeException(e.getCause().getMessage(), 
e.getCause());
             }
             log.debug("CreateCommand failed", e);
-        } catch (java.lang.Exception e) {
-            log.debug("CreateCommand failed", e);
         }
-
         return null;
 
     }


--
To view, visit http://gerrit.ovirt.org/9702
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id67567ccabb65c73499cbae7d0a179afe6d88244
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Michael Kublin <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to