RFR: 8287107: CgroupSubsystemFactory.setCgroupV2Path asserts with freezer controller [v3]

Ioi Lam iklam at openjdk.java.net
Wed May 25 15:51:06 UTC 2022


On Tue, 24 May 2022 19:49:35 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> My bad. How about `Intentional incomplete switch. There are ...`? Anyway, why is the empty `default` case needed other than for the comment?
>
> To me, the `default:` switch is a clear indication that "everything else comes here". So you won't be confused whether the comment is related to the last line just above the comment.

If you don't like the `default:` coding style, how about this:


switch (info.getName()) {
// Only the following controllers are important to Java. All
// other controllers (such as freezer) are ignored and
// are not considered in the checks below for
// anyCgroupsV1Controller/anyCgroupsV1Controller.
case CPU_CTRL:      infos.put(CPU_CTRL, info); break;
case CPUACCT_CTRL:  infos.put(CPUACCT_CTRL, info); break;
case CPUSET_CTRL:   infos.put(CPUSET_CTRL, info); break;
case MEMORY_CTRL:   infos.put(MEMORY_CTRL, info); break;
case BLKIO_CTRL:    infos.put(BLKIO_CTRL, info); break;
case PIDS_CTRL:     infos.put(PIDS_CTRL, info); break;
}

-------------

PR: https://git.openjdk.java.net/jdk/pull/8858


More information about the core-libs-dev mailing list