Yair Zaslavsky has posted comments on this change.
Change subject: core: Quota refactor - QuotaManager step 1
......................................................................
Patch Set 5: I would prefer that you didn't submit this
(2 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
Line 580: + ". Storage pool is not available for quota
calculation. ");
Line 581: }
Line 582:
Line 583: if (!consumptionParameters.isEmpty()) {
Line 584: return
QuotaManager.getInstance().consume(quotaConsumptionParametersWrapper);
In general, I would prefer that all singletons have a method of getSingleton
and this method will be used (and not MySingleton.getInstance() )
Reason - will make it easier for unit-tests (mocks) if we ever get to extend
them besides the canDoAction phase.
Line 585: } else {
Line 586: return true;
Line 587: }
Line 588: }
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManagerAuditLogger.java
Line 18: public static QuotaManagerAuditLogger getInstance() {
Line 19: return INSTANCE;
Line 20: }
Line 21:
Line 22: protected synchronized void auditLogStorage(AuditLogableBase
auditLogableBase, AuditLogType auditLogType, String quotaName,
Are you really sure these methods have to be synchronized?
I don't think they should be synchronized.
A. Not sure I understand why auditLogableBase is passed, and not created inside
these menthods.
B. Even if passed, I assume you don't share AuditLogabbleBase among threads,
and this is the only object that you change its state.
C. If you do share - this is bad, I don't see any code that cleans up the
custom values added.
Line 23: double
storageUsagePercentage,
Line 24: double
storageRequestedPercentage) {
Line 25: auditLogableBase.AddCustomValue("QuotaName", quotaName);
Line 26: auditLogableBase.AddCustomValue("CurrentStorage",
percentageFormatter.format(storageUsagePercentage));
--
To view, visit http://gerrit.ovirt.org/8776
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibb100467a55b26e4219d1a2562da86b81ffdc032
Gerrit-PatchSet: 5
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