Skip to content

Commit a01e8b7

Browse files
committed
[GR-42465] Reset JDKs cgroup subsystem instances.
PullRequest: graal/13182
2 parents 46ce9d5 + 341d635 commit a01e8b7

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright (c) 2022, 2022, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
package com.oracle.svm.core.jdk;
27+
28+
import org.graalvm.nativeimage.Platform.LINUX;
29+
30+
import java.util.List;
31+
import java.util.concurrent.CopyOnWriteArrayList;
32+
33+
import org.graalvm.nativeimage.Platforms;
34+
35+
import com.oracle.svm.core.annotate.Alias;
36+
import com.oracle.svm.core.annotate.RecomputeFieldValue;
37+
import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
38+
39+
import com.oracle.svm.core.annotate.TargetClass;
40+
41+
@TargetClass(className = "jdk.internal.platform.cgroupv1.CgroupV1Subsystem", onlyWith = JDK17OrLater.class)
42+
@Platforms(LINUX.class)
43+
final class Target_jdk_internal_platform_cgroupv1_CgroupV1Subsystem {
44+
@Alias //
45+
@RecomputeFieldValue(kind = Kind.Reset) //
46+
private static volatile Target_jdk_internal_platform_cgroupv1_CgroupV1Subsystem INSTANCE;
47+
}
48+
49+
@TargetClass(className = "jdk.internal.platform.cgroupv2.CgroupV2Subsystem", onlyWith = JDK17OrLater.class)
50+
@Platforms(LINUX.class)
51+
final class Target_jdk_internal_platform_cgroupv2_CgroupV2Subsystem {
52+
@Alias //
53+
@RecomputeFieldValue(kind = Kind.Reset) //
54+
private static volatile Target_jdk_internal_platform_cgroupv2_CgroupV2Subsystem INSTANCE;
55+
}
56+
57+
@TargetClass(className = "jdk.jfr.internal.instrument.JDKEvents", onlyWith = JDK17OrLater.class)
58+
@Platforms(LINUX.class)
59+
final class Target_jdk_jfr_internal_instrument_JDKEvents {
60+
@Alias //
61+
@RecomputeFieldValue(kind = Kind.Reset) //
62+
private static Target_jdk_internal_platform_Metrics containerMetrics;
63+
64+
@Alias //
65+
@RecomputeFieldValue(kind = Kind.Reset) //
66+
private static boolean initializationTriggered;
67+
}
68+
69+
@TargetClass(className = "jdk.jfr.internal.RequestEngine", onlyWith = JDK17OrLater.class)
70+
@Platforms(LINUX.class)
71+
final class Target_jdk_jfr_internal_RequestEngine {
72+
@Alias //
73+
@RecomputeFieldValue(kind = Kind.NewInstance, declClass = CopyOnWriteArrayList.class) //
74+
private static List<?> entries;
75+
}
76+
77+
// Only present in JDKs without JDK-8268398
78+
@TargetClass(className = "jdk.jfr.internal.Utils", onlyWith = {JDK17OrEarlier.class, JDK17OrLater.class})
79+
@Platforms(LINUX.class)
80+
final class Target_jdk_jfr_internal_Utils {
81+
@Alias //
82+
@RecomputeFieldValue(kind = Kind.Reset) //
83+
private static Target_jdk_internal_platform_Metrics[] metrics;
84+
}
85+
86+
@TargetClass(className = "jdk.internal.platform.Metrics", onlyWith = JDK17OrLater.class)
87+
@Platforms(LINUX.class)
88+
final class Target_jdk_internal_platform_Metrics {
89+
}
90+
91+
/** Dummy class to have a class with the file's name. */
92+
public final class JDKContainerSubstitutions {
93+
}

0 commit comments

Comments
 (0)