Interface CGroupsHandler
- All Known Implementing Classes:
AbstractCGroupsHandler
@Private
@Unstable
public interface CGroupsHandler
Provides CGroups functionality. Implementations are expected to be
thread-safe
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumList of supported cgroup controller types. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptioncreateCGroup(CGroupsHandler.CGroupController controller, String cGroupId) Creates a cgroup for a given controller.voiddeleteCGroup(CGroupsHandler.CGroupController controller, String cGroupId) Deletes the specified cgroup.Returns CGroup Mount Path.getCGroupParam(CGroupsHandler.CGroupController controller, String cGroupId, String param) reads a cgroup parameter value, given a controller, cgroup id, parameter.Returns CGroupV2 Mount Path.getControllerPath(CGroupsHandler.CGroupController controller) Gets the absolute path to the specified cgroup controller.getPathForCGroup(CGroupsHandler.CGroupController controller, String cGroupId) Gets the full path for the cgroup, given a controller and a cgroup id.getPathForCGroupParam(CGroupsHandler.CGroupController controller, String cGroupId, String param) Gets the full path for a cgroup parameter, given a controller, cgroup id and parameter name.getPathForCGroupTasks(CGroupsHandler.CGroupController controller, String cGroupId) Gets the full path for the cgroup's tasks file, given a controller and a cgroup id.getRelativePathForCGroup(String cGroupId) Gets the relative path for the cgroup, independent of a controller, for a given cgroup id.Gets the valid cgroup controller names based on the version used.voidMounts or initializes a cgroup controller.voidupdateCGroupParam(CGroupsHandler.CGroupController controller, String cGroupId, String param, String value) updates a cgroup parameter, given a controller, cgroup id, parameter name.
-
Field Details
-
CGROUP_PARAM_MEMORY_HARD_LIMIT_BYTES
- See Also:
-
CGROUP_PARAM_MEMORY_SWAP_HARD_LIMIT_BYTES
- See Also:
-
CGROUP_PARAM_MEMORY_SOFT_LIMIT_BYTES
- See Also:
-
CGROUP_PARAM_MEMORY_OOM_CONTROL
- See Also:
-
CGROUP_PARAM_MEMORY_SWAPPINESS
- See Also:
-
CGROUP_PARAM_MEMORY_USAGE_BYTES
- See Also:
-
CGROUP_PARAM_MEMORY_MEMSW_USAGE_BYTES
- See Also:
-
CGROUP_NO_LIMIT
- See Also:
-
UNDER_OOM
- See Also:
-
CGROUP_CPU_PERIOD_US
- See Also:
-
CGROUP_CPU_QUOTA_US
- See Also:
-
CGROUP_CPU_SHARES
- See Also:
-
CGROUP_CONTROLLERS_FILE
- See Also:
-
CGROUP_SUBTREE_CONTROL_FILE
- See Also:
-
CGROUP_CPU_MAX
- See Also:
-
CGROUP_MEMORY_MAX
- See Also:
-
CGROUP_MEMORY_LOW
- See Also:
-
CGROUP_PROCS_FILE
- See Also:
-
CGROUP_PARAM_CLASSID
- See Also:
-
CGROUP_PARAM_WEIGHT
- See Also:
-
-
Method Details
-
initializeCGroupController
void initializeCGroupController(CGroupsHandler.CGroupController controller) throws ResourceHandlerException Mounts or initializes a cgroup controller.- Parameters:
controller- - the controller being initialized- Throws:
ResourceHandlerException- the initialization failed due to the environment
-
createCGroup
String createCGroup(CGroupsHandler.CGroupController controller, String cGroupId) throws ResourceHandlerException Creates a cgroup for a given controller.- Parameters:
controller- - controller type for which the cgroup is being createdcGroupId- - id of the cgroup being created- Returns:
- full path to created cgroup
- Throws:
ResourceHandlerException- creation failed
-
deleteCGroup
void deleteCGroup(CGroupsHandler.CGroupController controller, String cGroupId) throws ResourceHandlerException Deletes the specified cgroup.- Parameters:
controller- - controller type for the cgroupcGroupId- - id of the cgroup being deleted- Throws:
ResourceHandlerException- deletion failed
-
getControllerPath
Gets the absolute path to the specified cgroup controller.- Parameters:
controller- - controller type for the cgroup- Returns:
- the root of the controller.
-
getValidCGroups
Gets the valid cgroup controller names based on the version used.- Returns:
- a set containing the valid controller names for the used cgroup version.
-
getRelativePathForCGroup
Gets the relative path for the cgroup, independent of a controller, for a given cgroup id.- Parameters:
cGroupId- - id of the cgroup- Returns:
- path for the cgroup relative to the root of (any) controller.
-
getPathForCGroup
Gets the full path for the cgroup, given a controller and a cgroup id.- Parameters:
controller- - controller type for the cgroupcGroupId- - id of the cgroup- Returns:
- full path for the cgroup
-
getPathForCGroupTasks
Gets the full path for the cgroup's tasks file, given a controller and a cgroup id.- Parameters:
controller- - controller type for the cgroupcGroupId- - id of the cgroup- Returns:
- full path for the cgroup's tasks file
-
getPathForCGroupParam
String getPathForCGroupParam(CGroupsHandler.CGroupController controller, String cGroupId, String param) Gets the full path for a cgroup parameter, given a controller, cgroup id and parameter name.- Parameters:
controller- - controller type for the cgroupcGroupId- - id of the cgroupparam- - cgroup parameter ( e.g classid )- Returns:
- full path for the cgroup parameter
-
updateCGroupParam
void updateCGroupParam(CGroupsHandler.CGroupController controller, String cGroupId, String param, String value) throws ResourceHandlerException updates a cgroup parameter, given a controller, cgroup id, parameter name. and a parameter value- Parameters:
controller- - controller type for the cgroupcGroupId- - id of the cgroupparam- - cgroup parameter ( e.g classid )value- - value to be written to the parameter file- Throws:
ResourceHandlerException- the operation failed
-
getCGroupParam
String getCGroupParam(CGroupsHandler.CGroupController controller, String cGroupId, String param) throws ResourceHandlerException reads a cgroup parameter value, given a controller, cgroup id, parameter. name- Parameters:
controller- - controller type for the cgroupcGroupId- - id of the cgroupparam- - cgroup parameter ( e.g classid )- Returns:
- parameter value as read from the parameter file
- Throws:
ResourceHandlerException- the operation failed
-
getCGroupMountPath
String getCGroupMountPath()Returns CGroup Mount Path.- Returns:
- parameter value as read from the parameter file
-
getCGroupV2MountPath
String getCGroupV2MountPath()Returns CGroupV2 Mount Path.- Returns:
- parameter value as read from the parameter file
-