Change in ovirt-engine[master]: core: StorageDomainNumberOfVmDisksComparator streaming

amureini at redhat.com amureini at redhat.com
Wed Jul 20 13:45:58 UTC 2016


Allon Mureinik has submitted this change and it was merged.

Change subject: core: StorageDomainNumberOfVmDisksComparator streaming
......................................................................


core: StorageDomainNumberOfVmDisksComparator streaming

The StorageDomainNumberOfVmDisksComparator constructor converts a
collections of DiskImages to a map from the storage domain id to the
number of VMs located on it.

This is much easier to do with Java 8's steam APIs instead of
reinventing the wheel ourselves.

As a side effect of this patch, the Map was converted from
Map<Guid, Integer> to Map<Guid, Long> to conform to
Collectors.counting()'s API. This may add some minor memory
consumption overhead, as Longs are larger than Integers, but this is
negligible as this Comparator is extremely short lived.

Change-Id: Id8271fd39eb270090f25ebd9bd32351d61fa465b
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/memory/sdcomparators/StorageDomainNumberOfVmDisksComparator.java
1 file changed, 7 insertions(+), 15 deletions(-)

Approvals:
  Tal Nisan: Looks good to me, approved
  Allon Mureinik: Verified; Passed CI tests
  Idan Shaby: Looks good to me, but someone else must approve



-- 
To view, visit https://gerrit.ovirt.org/60655
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id8271fd39eb270090f25ebd9bd32351d61fa465b
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Idan Shaby <ishaby at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list