|
@@ -678,7 +678,15 @@ public class DatanodeManager {
|
|
|
Consumer<List<DatanodeInfoWithStorage>> secondarySort = null;
|
|
|
if (readConsiderStorageType) {
|
|
|
Comparator<DatanodeInfoWithStorage> comp =
|
|
|
- Comparator.comparing(DatanodeInfoWithStorage::getStorageType);
|
|
|
+ Comparator.comparing(DatanodeInfoWithStorage::getStorageType, (s1, s2) -> {
|
|
|
+ if (s1 == null) {
|
|
|
+ return (s2 == null) ? 0 : -1;
|
|
|
+ } else if (s2 == null) {
|
|
|
+ return 1;
|
|
|
+ } else {
|
|
|
+ return s2.compareTo(s1);
|
|
|
+ }
|
|
|
+ });
|
|
|
secondarySort = list -> Collections.sort(list, comp);
|
|
|
}
|
|
|
if (readConsiderLoad) {
|