Skip to content

Commit

Permalink
nfs: use Comparator.comparing unstead of guava's Ordering
Browse files Browse the repository at this point in the history
Use java standard API as recommended by guava

Acked-by: Lea Morschel
Target: master
  • Loading branch information
kofemann committed Oct 24, 2022
1 parent 91708e3 commit 4247348
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/src/main/java/org/dcache/nfs/ExportFile.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 - 2020 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
Expand All @@ -24,7 +24,7 @@
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Ordering;
import java.util.Comparator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -135,11 +135,11 @@ private static ImmutableMultimap<Integer, FsExport> parse(URI... exportFiles) th
}

/*
* sort in reverse order to get smallest network first
* sort in reverse order to get the smallest network first
*/
return exportsBuilder
.orderValuesBy(Ordering.from(HostEntryComparator::compare).onResultOf(FsExport::client))
.build();
.orderValuesBy(Comparator.comparing(FsExport::client, HostEntryComparator::compare))
.build();
}

private static ImmutableMultimap<Integer, FsExport> parseExportLines(Iterable<String> lines) throws IOException {
Expand Down Expand Up @@ -304,11 +304,11 @@ private static ImmutableMultimap<Integer, FsExport> parseExportLines(Iterable<St
}

/*
* sort in reverse order to get smallest network first
* sort in reverse order to get the smallest network first
*/
return exportsBuilder
.orderValuesBy(Ordering.from(HostEntryComparator::compare).onResultOf(FsExport::client))
.build();
.orderValuesBy(Comparator.comparing(FsExport::client, HostEntryComparator::compare))
.build();
}

@Override
Expand All @@ -331,7 +331,7 @@ public FsExport getExport(int index, InetAddress client) {
public Stream<FsExport> exports(InetAddress client) {
return _exports.values().stream()
.filter(e -> e.isAllowed(client))
.sorted(Ordering.from(HostEntryComparator::compare).onResultOf(FsExport::client));
.sorted(Comparator.comparing(FsExport::client,HostEntryComparator::compare));
}

public final void rescan() throws IOException {
Expand Down

0 comments on commit 4247348

Please sign in to comment.