Allon Mureinik has uploaded a new change for review. Change subject: core: ExternalSchedulerDiscoveryResult map iter ......................................................................
core: ExternalSchedulerDiscoveryResult map iter Replaced keySeT() iteration with entrySet() iteration to improve performance. This patch fixes the WMI_WRONG_MAP_ITERATOR FindBugs warning on this class. Change-Id: I27d1a45bbc184bf467a283f0932a27db8c880831 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java 1 file changed, 8 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/18997/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java index ced2d80..61a239a 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/external/ExternalSchedulerDiscoveryResult.java @@ -3,6 +3,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.utils.customprop.SimpleCustomPropertiesUtil; @@ -35,16 +36,18 @@ HashMap<String, HashMap<String, Object[]>> castedResult = (HashMap<String, HashMap<String, Object[]>>) xmlRpcRawResult; // keys will be filter, score and balance - for (String type : castedResult.keySet()) { - HashMap<String, Object[]> typeMap = castedResult.get(type); + for (Map.Entry<String, HashMap<String, Object[]>> entry : castedResult.entrySet()) { + String type = entry.getKey(); + HashMap<String, Object[]> typeMap = entry.getValue(); List<ExternalSchedulerDiscoveryUnit> currentList = getRelevantList(type); if (currentList == null) { log.error("External scheduler error, got unknown type"); return false; } - // list of module names as keys and [description, regex] as value - for (String moduleName : typeMap.keySet()) { - Object[] singleModule = typeMap.get(moduleName); + // list of module names as keys and [description, regex] as value + for (Map.Entry<String, Object[]> module: typeMap.entrySet()) { + String moduleName = module.getKey(); + Object[] singleModule = module.getValue(); // check custom properties format. String customPropertiesRegex = singleModule[1].toString(); if (!StringUtils.isEmpty(customPropertiesRegex) && SimpleCustomPropertiesUtil.getInstance() -- To view, visit http://gerrit.ovirt.org/18997 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I27d1a45bbc184bf467a283f0932a27db8c880831 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
