Allon Mureinik has uploaded a new change for review.

Change subject: core: EnumUtils - used cached map of available
......................................................................

core: EnumUtils - used cached map of available

Reuse the cached version of the uppercase map in EnumUtils if it already
existed.

This has two slight benefits:
1. Better memory management, by making sure we're reusing the same
   references all over.
2. It solves the normal priority FindBugs
   RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED  warning on this issue.

Change-Id: I486a09d190a2c02be666400c59795e7104f83d79
Signed-off-by: Allon Mureinik <amure...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/EnumUtils.java
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/13231/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/EnumUtils.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/EnumUtils.java
index 41bded6..45bb790 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/EnumUtils.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/EnumUtils.java
@@ -31,7 +31,10 @@
             for (E e : universe) {
                 map.put(e.name().toUpperCase(), e);
             }
-            cacheEnumValuesInCapitalLetters.putIfAbsent(c, map);
+            Map<String, E> ret = 
cacheEnumValuesInCapitalLetters.putIfAbsent(c, map);
+            if (ret != null) {
+                map = ret;
+            }
         }
 
         E result = map.get(name.toUpperCase());


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I486a09d190a2c02be666400c59795e7104f83d79
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to