Yair Zaslavsky has posted comments on this change.
Change subject: core: Quota refactor - QuotaManager step 2
......................................................................
Patch Set 9: I would prefer that you didn't submit this
(5 inline comments)
Please see my question about the null issue.
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
Line 33: private final static DecimalFormat percentageFormatter = new
DecimalFormat("#.##");
Line 34: private static QuotaManagerAuditLogger quotaManagerAuditLogger =
new QuotaManagerAuditLogger();
Line 35: private final ConcurrentHashMap<Guid, Map<Guid, Quota>>
storagePoolQuotaMap =
Line 36: new ConcurrentHashMap<Guid, Map<Guid, Quota>>();
Line 37: private final ConcurrentHashMap<Guid, Quota> directQuotaMap = new
ConcurrentHashMap<Guid, Quota>();
Change this to ConcurrentMap<Guid, Quota> directQuotaMap = new
ConcurrentHashMap<Guid, Quota>();
Line 38:
Line 39: public static QuotaManager getInstance() {
Line 40: return INSTANCE;
Line 41: }
Line 763: return true;
Line 764: }
Line 765:
Line 766: boolean hardEnforcement =
Line 767:
QuotaEnforcementTypeEnum.HARD_ENFORCEMENT.equals(parameters.getStorage_pool().getQuotaEnforcementType());
No need to use equals on enums. Use ==
Line 768:
Line 769: // for each parameter - check and complete
Line 770: for (QuotaConsumptionParameter param :
parameters.getParameters()) {
Line 771: // check that quota id is valid and fetch the quota from
db (or cache). add the quota to the param
Line 773:
Line 774: // In case this param is a QuotaVdsConsumptionParameter -
check that it has a valid
Line 775: // vds group id which is handled by this quota
Line 776: boolean validVdsGroup = false;
Line 777: if (param instanceof QuotaVdsConsumptionParameter) {
I would consider having a trinary if here, but it's not mandatory
Line 778: validVdsGroup = checkVdsGroupMatchQuota(parameters,
param);
Line 779: } else {
Line 780: validVdsGroup = true;
Line 781: }
Line 782:
Line 783: // In case this param is a
QuotaStorageConsumptionParameter - check that it has a valid
Line 784: // storage domain id which is handled by this quota
Line 785: boolean validStorageDomain = false;
Line 786: if (param instanceof QuotaStorageConsumptionParameter) {
I would consider having a trinary if here , but t's not mandatory.
Line 787: validStorageDomain =
checkStoragePoolMatchQuota(parameters, param);
Line 788: } else {
Line 789: validStorageDomain = true;
Line 790: }
Line 901: // if the id is valid
Line 902: if (quotaId != null && quotaId != Guid.Empty) {
Line 903: if (!directQuotaMap.contains(quotaId)) {
Line 904: // cache in direct quota map
Line 905: Quota quota = getQuotaDAO().getById(quotaId);
Can't this be null? What happens if it is?
Line 906: lock.readLock().lock();
Line 907:
Line 908: directQuotaMap.put(quotaId, quota);
Line 909: // cache in storage-pool->quota map
--
To view, visit http://gerrit.ovirt.org/8777
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I15314d6269d1f5f43de17c36a6ae91ba874c8a58
Gerrit-PatchSet: 9
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: ofri masad <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Laszlo Hornyak <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Sharad Mishra <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: ofri masad <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches