Gilad Chaplik has uploaded a new change for review.

Change subject: core: fixing findbugs errors
......................................................................

core: fixing findbugs errors

* fixing wrong caching
* no refernce to field

Change-Id: Iad6f990d93bfdc5bfbd7179cffee4893ef40ccc5
Signed-off-by: Gilad Chaplik <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/scheduling/ClusterPolicyDaoImpl.java
1 file changed, 4 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/50/18550/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/scheduling/ClusterPolicyDaoImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/scheduling/ClusterPolicyDaoImpl.java
index 570f108..6e70454 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/scheduling/ClusterPolicyDaoImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/scheduling/ClusterPolicyDaoImpl.java
@@ -19,7 +19,6 @@
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 
 public class ClusterPolicyDaoImpl extends 
DefaultGenericDaoDbFacade<ClusterPolicy, Guid> implements ClusterPolicyDao {
-    private static Map<Guid, PolicyUnit> policyUnitMap = null;
 
     public ClusterPolicyDaoImpl() {
         super("ClusterPolicy");
@@ -81,11 +80,9 @@
     }
 
     private void fillClusterPolicy(Map<Guid, ClusterPolicy> map, 
List<ClusterPolicyUnit> clusterPolicyUnits) {
-        if (policyUnitMap == null) {
-            policyUnitMap = new HashMap<Guid, PolicyUnit>();
-            for (PolicyUnit policyUnit : dbFacade.getPolicyUnitDao().getAll()) 
{
-                policyUnitMap.put(policyUnit.getId(), policyUnit);
-            }
+        Map<Guid, PolicyUnit> policyUnitMap = new HashMap<Guid, PolicyUnit>();
+        for (PolicyUnit policyUnit : dbFacade.getPolicyUnitDao().getAll()) {
+            policyUnitMap.put(policyUnit.getId(), policyUnit);
         }
         for (ClusterPolicyUnit clusterPolicyUnit : clusterPolicyUnits) {
             ClusterPolicy clusterPolicy = 
map.get(clusterPolicyUnit.getClusterPolicyId());
@@ -134,7 +131,7 @@
             }
         }
         if (entity.getBalance() != null) {
-            unit = getClusterPolicyUnit(entity, entity.getBalance(), map);
+            getClusterPolicyUnit(entity, entity.getBalance(), map);
         }
         return new ArrayList<ClusterPolicyUnit>(map.values());
     }


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

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

Reply via email to