Skip to content

Commit 63826d4

Browse files
committed
Fix intermittent LogGeneratedClassesTest failures
Fix intermittent LogGeneratedClassesTest failures by removing use of lambda expression in static block of InternalCRIUSupport, which avoids the unexpected creation of lambda class files for InternalCRIUSupport during the test. Issue: #18556 Signed-off-by: Amarpreet Singh <[email protected]>
1 parent da2c022 commit 63826d4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jcl/src/java.base/share/classes/openj9/internal/criu/InternalCRIUSupport.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private static native void checkpointJVMImpl(String imageDir,
231231

232232
private static native String[] getRestoreSystemProperites();
233233

234-
static {
234+
private static void initializeUnsafe() {
235235
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
236236
try {
237237
Field f = Unsafe.class.getDeclaredField("theUnsafe"); //$NON-NLS-1$
@@ -809,6 +809,10 @@ private void registerRestoreEnvVariables() {
809809
return;
810810
}
811811

812+
if (unsafe == null) {
813+
initializeUnsafe();
814+
}
815+
812816
J9InternalCheckpointHookAPI.registerPostRestoreHook(HookMode.SINGLE_THREAD_MODE, RESTORE_ENVIRONMENT_VARIABLES_PRIORITY,
813817
"Restore environment variables via env file: " + envFile, () -> { //$NON-NLS-1$
814818
if (!Files.exists(this.envFile)) {

0 commit comments

Comments
 (0)