APIdia Launch Partner
Top Inners Fields Constructors Methods
jdk.internal.platform

public Class CgroupSubsystemFactory

extends Object
Class Inheritance
Imports
java.io.IOException, .UncheckedIOException, java.lang.System.Logger, .System.Logger.Level, java.nio.file.Files, .Path, java.util.Collections, .HashMap, .List, .Map, .Optional, .Objects, java.util.function.Consumer, java.util.regex.Matcher, .Pattern, java.util.stream.Stream, jdk.internal.platform.cgroupv1.CgroupV1Subsystem, jdk.internal.platform.cgroupv2.CgroupV2Subsystem

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private static final String
private static final Pattern
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true iff a relevant controller has been found at the given line
amendCgroupInfos
(String mntInfoLine, Map<String, CgroupInfo> infos, boolean isCgroupsV2)

Amends cgroup infos with mount path and mount root.

pack-priv static CgroupMetrics
public static CgroupMetrics
public static Optional<CgroupSubsystemFactory.CgroupTypeResult>
determineType(String mountInfo, String cgroups, String selfCgroup)

private static void
private static void
private static void
setMountPoints(CgroupInfo info, String mountPath, String mountRoot)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BLKIO_CTRLback to summary
private static final String BLKIO_CTRL
CPU_CTRLback to summary
private static final String CPU_CTRL
CPUACCT_CTRLback to summary
private static final String CPUACCT_CTRL
CPUSET_CTRLback to summary
private static final String CPUSET_CTRL
MEMORY_CTRLback to summary
private static final String MEMORY_CTRL
MOUNTINFO_PATTERNback to summary
private static final Pattern MOUNTINFO_PATTERN
PIDS_CTRLback to summary
private static final String PIDS_CTRL

Constructor Detail

CgroupSubsystemFactoryback to summary
public CgroupSubsystemFactory()

Method Detail

amendCgroupInfosback to summary
private static boolean amendCgroupInfos(String mntInfoLine, Map<String, CgroupInfo> infos, boolean isCgroupsV2)

Amends cgroup infos with mount path and mount root. The passed in 'mntInfoLine' represents a single line in, for example, /proc/self/mountinfo. Each line is matched with MOUNTINFO_PATTERN (see above), so as to extract the relevant tokens from the line. Host example cgroups v1: 44 30 0:41 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,seclabel,devices Container example cgroups v1: 1901 1894 0:37 /system.slice/docker-2291eeb92093f9d761aaf971782b575e9be56bd5930d4b5759b51017df3c1387.scope /sys/fs/cgroup/cpu,cpuacct ro,nosuid,nodev,noexec,relatime master:12 - cgroup cgroup rw,seclabel,cpu,cpuacct Container example cgroups v2: 1043 1034 0:27 / /sys/fs/cgroup ro,nosuid,nodev,noexec,relatime - cgroup2 cgroup2 rw,seclabel,nsdelegate

Returns:boolean

true iff a relevant controller has been found at the given line

createback to summary
pack-priv static CgroupMetrics create()
createback to summary
public static CgroupMetrics create(Optional<CgroupSubsystemFactory.CgroupTypeResult> optResult)
determineTypeback to summary
public static Optional<CgroupSubsystemFactory.CgroupTypeResult> determineType(String mountInfo, String cgroups, String selfCgroup) throws IOException
setCgroupV1Pathback to summary
private static void setCgroupV1Path(Map<String, CgroupInfo> infos, String[] tokens)
setCgroupV2Pathback to summary
private static void setCgroupV2Path(Map<String, CgroupInfo> infos, String[] tokens)
setMountPointsback to summary
private static void setMountPoints(CgroupInfo info, String mountPath, String mountRoot)
jdk.internal.platform back to summary

public final Class CgroupSubsystemFactory.CgroupTypeResult

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.internal.platform.CgroupSubsystemFactory.CgroupTypeResult

Field Summary

Modifier and TypeField and Description
private final boolean
private final boolean
private final boolean
private final Map<String, CgroupInfo>
private final boolean

Constructor Summary

AccessConstructor and Description
private
CgroupTypeResult(boolean isCgroupV2, boolean anyControllersEnabled, boolean anyCgroupV2Controllers, boolean anyCgroupV1Controllers, Map<String, CgroupInfo> infos)

Method Summary

Modifier and TypeMethod and Description
public Map<String, CgroupInfo>
public boolean
public boolean
public boolean
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

anyCgroupV1Controllersback to summary
private final boolean anyCgroupV1Controllers
anyCgroupV2Controllersback to summary
private final boolean anyCgroupV2Controllers
anyControllersEnabledback to summary
private final boolean anyControllersEnabled
infosback to summary
private final Map<String, CgroupInfo> infos
isCgroupV2back to summary
private final boolean isCgroupV2

Constructor Detail

CgroupTypeResultback to summary
private CgroupTypeResult(boolean isCgroupV2, boolean anyControllersEnabled, boolean anyCgroupV2Controllers, boolean anyCgroupV1Controllers, Map<String, CgroupInfo> infos)

Method Detail

getInfosback to summary
public Map<String, CgroupInfo> getInfos()
isAnyCgroupV1Controllersback to summary
public boolean isAnyCgroupV1Controllers()
isAnyCgroupV2Controllersback to summary
public boolean isAnyCgroupV2Controllers()
isAnyControllersEnabledback to summary
public boolean isAnyControllersEnabled()
isCgroupV2back to summary
public boolean isCgroupV2()