RFR: 8274319: Replace usages of Collections.sort with List.sort call in jdk.jfr [v2]

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Fri Oct 8 20:14:34 UTC 2021


On Fri, 8 Oct 2021 14:43:20 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8274319: Replace usages of Collections.sort with List.sort call in jdk.jfr
>>   fix post-review comments
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/dcmd/AbstractDCmd.java line 172:
> 
>> 170:     protected final List<Recording> getRecordings() {
>> 171:         List<Recording> list = new ArrayList<>(getFlightRecorder().getRecordings());
>> 172:         list.sort(Comparator.comparing(Recording::getId));
> 
> Use Comparator.comparingLong instead?

Changed

> src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Summary.java line 146:
> 
>> 144:             println(" Duration: " + (totalDuration + 500_000_000) / 1_000_000_000 + " s");
>> 145:             List<Statistics> statsList = new ArrayList<>(stats.values());
>> 146:             statsList.sort(Comparator.comparingLong(v -> v.count));
> 
> This looks incorrect. the order is reversed compared to before.
> 
> Events with a high count should appear on top.

Oops. Fixed.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5696


More information about the hotspot-jfr-dev mailing list