Skip to content

Commit 1bd3809

Browse files
committed
Revert "IDE-suggested drive-by: extract comparator creation"
This reverts commit c25a037 due to erroneous push.
1 parent c25a037 commit 1bd3809

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

modules/dcache/src/main/java/org/dcache/pool/classic/IoQueueManager.java

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.dcache.pool.FaultEvent;
3333
import org.dcache.pool.FaultListener;
3434
import org.dcache.pool.classic.MoverRequestScheduler.Order;
35-
import org.dcache.pool.classic.MoverRequestScheduler.PrioritizedRequest;
3635
import org.dcache.util.IoPriority;
3736
import org.slf4j.Logger;
3837
import org.slf4j.LoggerFactory;
@@ -444,7 +443,24 @@ public Serializable call() throws CommandException {
444443
.toArray(IoJobInfo[]::new);
445444
} else {
446445

447-
Comparator<PrioritizedRequest> comparator = getPrioritizedRequestComparator();
446+
Comparator<MoverRequestScheduler.PrioritizedRequest> comparator;
447+
if (sortBySize) {
448+
comparator = (b, a) -> Long.compare(
449+
a.getMover().getBytesTransferred(), b.getMover().getBytesTransferred()
450+
);
451+
} else if (sortByTime) {
452+
comparator = (b, a) -> Long.compare(
453+
a.getMover().getLastTransferred(), b.getMover().getLastTransferred()
454+
);
455+
} else {
456+
comparator = (b, a) -> Integer.compare(
457+
a.getId(), b.getId()
458+
);
459+
}
460+
461+
if (reverseSort) {
462+
comparator = comparator.reversed();
463+
}
448464

449465
StringBuilder sb = new StringBuilder();
450466
if (groupByQueue) {
@@ -462,28 +478,6 @@ public Serializable call() throws CommandException {
462478
return sb.toString();
463479
}
464480
}
465-
466-
private Comparator<PrioritizedRequest> getPrioritizedRequestComparator() {
467-
Comparator<PrioritizedRequest> comparator;
468-
if (sortBySize) {
469-
comparator = (b, a) -> Long.compare(
470-
a.getMover().getBytesTransferred(), b.getMover().getBytesTransferred()
471-
);
472-
} else if (sortByTime) {
473-
comparator = (b, a) -> Long.compare(
474-
a.getMover().getLastTransferred(), b.getMover().getLastTransferred()
475-
);
476-
} else {
477-
comparator = (b, a) -> Integer.compare(
478-
a.getId(), b.getId()
479-
);
480-
}
481-
482-
if (reverseSort) {
483-
comparator = comparator.reversed();
484-
}
485-
return comparator;
486-
}
487481
}
488482

489483
@Command(name = "p2p ls", hint = "list pool to pool source movers",

0 commit comments

Comments
 (0)