< prev index next >
test/lib/jdk/test/lib/containers/cgroup/CPUSetsReader.java
Print this page
@ rev 57734 : Review feedback
|
~
*** 30,39 ****
--- 30,40 ----
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
+
import jdk.test.lib.Asserts;
// A simple CPU sets reader and parser
public class CPUSetsReader {
*** 52,63 ****
Asserts.assertEquals(listToString(parseCpuSet(cpuSet)), expectedResult);
}
public static int getNumCpus() {
String path = "/proc/cpuinfo";
! try {
! Stream<String> stream = Files.lines(Paths.get(path));
return (int) stream.filter(line -> line.startsWith("processor")).count();
} catch (IOException e) {
return 0;
}
}
--- 53,63 ----
Asserts.assertEquals(listToString(parseCpuSet(cpuSet)), expectedResult);
}
public static int getNumCpus() {
String path = "/proc/cpuinfo";
! try(Stream<String> stream = Files.lines(Paths.get(path))) {
return (int) stream.filter(line -> line.startsWith("processor")).count();
} catch (IOException e) {
return 0;
}
}
< prev index next >