Moti Asayag has posted comments on this change.

Change subject: gluster : In the task tab, size of rebalanced files is shown 
with units
......................................................................


Patch Set 26:

(2 comments)

....................................................
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/SizeConverter.java
Line 19: 
Line 20:     public static enum SizeUnit {
Line 21:         BYTES(1),
Line 22:         MB(3),
Line 23:         KB(2),
was the order of the enums changed on purpose?
Line 24:         GB(4);
Line 25: 
Line 26:         private long unitWeight;
Line 27: 


Line 29:         private SizeUnit(long unitWeight) {
Line 30:             this.unitWeight = unitWeight;
Line 31:         }
Line 32: 
Line 33:         private static void initWeightToUnit() {
this method could be either replaced with a static block or being modified a 
bit and called from a static block only once.

See for example 
./backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java

      static {
        for (VdcActionType action : values()) {
            mappings.put(action.getValue(), action);
        }
    }
 
This block will occur only once. At this case it should like similar to 
(haven't compiled it ;-)):
 static {
    for (SizeUnit unit : SizeUnit.values()) {
      weightToUnit.add(new Pair<Long, 
SizeConverter.SizeUnit>(unit.getUnitWeight(), unit));
    }
    
    Collections.sort(weightToUnit, Collections.reverseOrder(new 
CompareUnits()));
  }

so the if-else statement isn't required and there is no longer need to call the 
initWeightToUnit() method.
Line 34:             if(weightToUnit.size() == 0) {
Line 35:                 for (SizeUnit unit : SizeUnit.values()) {
Line 36:                     weightToUnit.add(new Pair<Long, 
SizeConverter.SizeUnit>(unit.getUnitWeight(), unit));
Line 37:                 }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iea6c90a098bfddfb616bc2b8ce58c9d0bb567f66
Gerrit-PatchSet: 26
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: anmolbabu <anb...@redhat.com>
Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Sahina Bose <sab...@redhat.com>
Gerrit-Reviewer: Shubhendu Tripathi <shtri...@redhat.com>
Gerrit-Reviewer: anmolbabu <anb...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to