Yevgeny Zaspitsky has posted comments on this change. Change subject: common: introduce qos package, and storage qos ......................................................................
Patch Set 5: (8 comments) http://gerrit.ovirt.org/#/c/27093/5/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/BaseQos.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/BaseQos.java: Line 14: /** Line 15: * Base abstract class for QoS objects Line 16: * Line 17: */ Line 18: public abstract class BaseQos extends IVdcQueryable implements BusinessEntity<Guid>, Serializable { > if you rely on other de-facto standards - this class should have probably b +1 for QosBase Line 19: private static final long serialVersionUID = 1122772549710787678L; Line 20: private Guid id = Guid.Empty; Line 21: private QosType qoSType; Line 22: Line 54: * Line 55: * @param other Line 56: * @return are equals Line 57: */ Line 58: public abstract boolean equalValues(BaseQos other); > please don't give example of code you've written/in-charge of, having said 1. when you say "vnic", please be aware that "vnic" != "NetworkQoS" 2. The object can not provide equality rules for every possible scenario. I'd move the equality logic to a separate Predicate class(es) Line 59: Line 60: /** Line 61: * @return derived values hash code Line 62: */ Line 59: Line 60: /** Line 61: * @return derived values hash code Line 62: */ Line 63: protected abstract int valuesHashCode(); According to my comment on hashCode method, this method is redundant. Line 64: Line 65: @Override Line 66: public Guid getId() { Line 67: return id; Line 95: Line 96: @Override Line 97: public int hashCode() { Line 98: final int prime = 31; Line 99: int result = valuesHashCode(); valuesHashCode should not be called here. The identity of the object is defined by name, type and dcId. If the object will be used in a Set or as the key of a Map using all properties as an object identity will be a bug. Line 100: result = prime * result + ((id == null) ? 0 : id.hashCode()); Line 101: result = prime * result + ((name == null) ? 0 : name.hashCode()); Line 102: result = prime * result + ((qoSType == null) ? 0 : qoSType.hashCode()); Line 103: result = prime * result + ((storagePoolId == null) ? 0 : storagePoolId.hashCode()); Line 129: if (other.storagePoolId != null) Line 130: return false; Line 131: } else if (!storagePoolId.equals(other.storagePoolId)) Line 132: return false; Line 133: return equalValues(other); equalValues should not be called here. The identity of the object is defined by name, type and dcId. If the object will be used in a Set or as the key of a Map using all properties as an object identity will be a bug. Line 134: } Line 135: http://gerrit.ovirt.org/#/c/27093/5/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/qos/StorageQos.java: Line 86: this.maxWriteIops = maxWriteIops; Line 87: } Line 88: Line 89: @Override Line 90: public boolean equalValues(BaseQos obj) { See my comments regarding equals/hashCode/equalValues/valuesHashCode in BaseQos class Line 91: if (!(obj instanceof StorageQos)) { Line 92: return false; Line 93: } Line 94: StorageQos other = (StorageQos) obj; Line 100: && ObjectUtils.objectsEqual(maxWriteIops, other.getMaxWriteIops()); Line 101: } Line 102: Line 103: @Override Line 104: public int valuesHashCode() { See my comments regarding equals/hashCode/equalValues/valuesHashCode in BaseQos class Line 105: final int prime = 31; Line 106: int result = 1; Line 107: result = prime * result + ((maxThroughput == null) ? 0 : maxThroughput.hashCode()); Line 108: result = prime * result + ((maxReadThroughput == null) ? 0 : maxReadThroughput.hashCode()); Line 114: } Line 115: Line 116: @Override Line 117: public String getString() { Line 118: StringBuilder builder = new StringBuilder(); 1. See my comments regarding toString/getString in BaseQos class 2. Aren't we interested in the values from BaseQos? Line 119: builder.append("[") Line 120: .append("Throughput") Line 121: .append("{") Line 122: .append("max=") -- To view, visit http://gerrit.ovirt.org/27093 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1a9af59277b5055453159f002f19046c0051d8ff Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Doron Fediuck <[email protected]> Gerrit-Reviewer: Gilad Chaplik <[email protected]> Gerrit-Reviewer: Kobi Ianko <[email protected]> Gerrit-Reviewer: Lior Vernia <[email protected]> Gerrit-Reviewer: Liron Ar <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Yevgeny Zaspitsky <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
