Package org.apache.storm.container.cgroup

## Class CgroupCommon

- java.lang.Object
- - org.apache.storm.container.cgroup.CgroupCommon

- All Implemented Interfaces:
    `CgroupCommonOperation`

      public class CgroupCommon
      extends Object
      implements CgroupCommonOperation

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `CGROUP_CLONE_CHILDREN` |
    `static String` | `CGROUP_EVENT_CONTROL` |
    `static String` | `CGROUP_PROCS` |
    `static String` | `NOTIFY_ON_RELEASE` |
    `static String` | `RELEASE_AGENT` |
    `static String` | `TASKS` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CgroupCommon​(String name, Hierarchy hierarchy, CgroupCommon parent)` |
    `CgroupCommon​(Hierarchy hierarchy, String dir)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addProcs​(int pid)` | add a process to cgroup.
    `void` | `addTask​(int taskId)` | add task to cgroup.
    `void` | `delete()` |
    `boolean` | `equals​(Object o)` |
    `boolean` | `getCgroupCloneChildren()` | get the cgroup.clone_children config.
    `Set<CgroupCommon>` | `getChildren()` |
    `Map<SubSystemType,​CgroupCore>` | `getCores()` |
    `String` | `getDir()` |
    `Hierarchy` | `getHierarchy()` |
    `String` | `getName()` |
    `boolean` | `getNotifyOnRelease()` | to get the notify_on_release config.
    `CgroupCommon` | `getParent()` |
    `Set<Long>` | `getPids()` | get the PIDs of processes running in cgroup.
    `String` | `getReleaseAgent()` | get the command for the relase agent to execute.
    `Set<Integer>` | `getTasks()` | Get a list of task ids running in CGroup.
    `int` | `hashCode()` |
    `boolean` | `isRoot()` |
    `void` | `setCgroupCloneChildren​(boolean flag)` | Set the cgroup.clone_children config.
    `void` | `setEventControl​(String eventFd, String controlFd, String... args)` | set event control config.
    `void` | `setNotifyOnRelease​(boolean flag)` | to set notify_on_release config in cgroup.
    `void` | `setReleaseAgent​(String command)` | set a command for the release agent to execute.
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### TASKS

          public static final String TASKS

      See Also:
        Constant Field Values

    - #### NOTIFY_ON_RELEASE

          public static final String NOTIFY_ON_RELEASE

      See Also:
        Constant Field Values

    - #### RELEASE_AGENT

          public static final String RELEASE_AGENT

      See Also:
        Constant Field Values

    - #### CGROUP_CLONE_CHILDREN

          public static final String CGROUP_CLONE_CHILDREN

      See Also:
        Constant Field Values

    - #### CGROUP_EVENT_CONTROL

          public static final String CGROUP_EVENT_CONTROL

      See Also:
        Constant Field Values

    - #### CGROUP_PROCS

          public static final String CGROUP_PROCS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CgroupCommon

          public CgroupCommon​(String name,
                              Hierarchy hierarchy,
                              CgroupCommon parent)

    - #### CgroupCommon

          public CgroupCommon​(Hierarchy hierarchy,
                              String dir)

  - ### Method Detail

    - #### addTask

          public void addTask​(int taskId)
                       throws IOException

      Description copied from interface: `CgroupCommonOperation`
      add task to cgroup.
      Specified by:
        `addTask` in interface `CgroupCommonOperation`
      Parameters:
        `taskId` - task id of task to add
      Throws:
        `IOException`

    - #### getTasks

          public Set<Integer> getTasks()
                                throws IOException

      Description copied from interface: `CgroupCommonOperation`
      Get a list of task ids running in CGroup.
      Specified by:
        `getTasks` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### addProcs

          public void addProcs​(int pid)
                        throws IOException

      Description copied from interface: `CgroupCommonOperation`
      add a process to cgroup.
      Specified by:
        `addProcs` in interface `CgroupCommonOperation`
      Parameters:
        `pid` - the PID of the process to add
      Throws:
        `IOException`

    - #### getPids

          public Set<Long> getPids()
                            throws IOException

      Description copied from interface: `CgroupCommonOperation`
      get the PIDs of processes running in cgroup.
      Specified by:
        `getPids` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### getNotifyOnRelease

          public boolean getNotifyOnRelease()
                                     throws IOException

      Description copied from interface: `CgroupCommonOperation`
      to get the notify_on_release config.
      Specified by:
        `getNotifyOnRelease` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### setNotifyOnRelease

          public void setNotifyOnRelease​(boolean flag)
                                  throws IOException

      Description copied from interface: `CgroupCommonOperation`
      to set notify_on_release config in cgroup.
      Specified by:
        `setNotifyOnRelease` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### getReleaseAgent

          public String getReleaseAgent()
                                 throws IOException

      Description copied from interface: `CgroupCommonOperation`
      get the command for the relase agent to execute.
      Specified by:
        `getReleaseAgent` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### setReleaseAgent

          public void setReleaseAgent​(String command)
                               throws IOException

      Description copied from interface: `CgroupCommonOperation`
      set a command for the release agent to execute.
      Specified by:
        `setReleaseAgent` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### getCgroupCloneChildren

          public boolean getCgroupCloneChildren()
                                         throws IOException

      Description copied from interface: `CgroupCommonOperation`
      get the cgroup.clone_children config.
      Specified by:
        `getCgroupCloneChildren` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### setCgroupCloneChildren

          public void setCgroupCloneChildren​(boolean flag)
                                      throws IOException

      Description copied from interface: `CgroupCommonOperation`
      Set the cgroup.clone_children config.
      Specified by:
        `setCgroupCloneChildren` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### setEventControl

          public void setEventControl​(String eventFd,
                                      String controlFd,
                                      String... args)
                               throws IOException

      Description copied from interface: `CgroupCommonOperation`
      set event control config.
      Specified by:
        `setEventControl` in interface `CgroupCommonOperation`
      Throws:
        `IOException`

    - #### getHierarchy

          public Hierarchy getHierarchy()

    - #### getName

          public String getName()

    - #### getDir

          public String getDir()

    - #### getParent

          public CgroupCommon getParent()

    - #### getChildren

          public Set<CgroupCommon> getChildren()

    - #### isRoot

          public boolean isRoot()

    - #### getCores

          public Map<SubSystemType,​CgroupCore> getCores()

    - #### delete

          public void delete()
                      throws IOException

      Throws:
        `IOException`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`