/// <exception cref="System.IO.IOException"/> private void UpdateCgroup(string controller, string groupName, string param, string value) { string path = PathForCgroup(controller, groupName); param = controller + "." + param; if (Log.IsDebugEnabled()) { Log.Debug("updateCgroup: " + path + ": " + param + "=" + value); } PrintWriter pw = null; try { FilePath file = new FilePath(path + "/" + param); TextWriter w = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); pw = new PrintWriter(w); pw.Write(value); } catch (IOException e) { throw new IOException("Unable to set " + param + "=" + value + " for cgroup at: " + path, e); } finally { if (pw != null) { bool hasError = pw.CheckError(); pw.Close(); if (hasError) { throw new IOException("Unable to set " + param + "=" + value + " for cgroup at: " + path); } if (pw.CheckError()) { throw new IOException("Error while closing cgroup file " + path); } } } }