changeset 57529:8b9577d77bba

8236661: launcher test PatchSystemModules.java start failing frequently after JDK-8234049 Reviewed-by: alanb, mchung
author bpb
date Tue, 14 Jan 2020 11:06:03 -0800
parents d9af3d39f4d3
children 289e13d49451
files src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Tue Jan 14 11:06:00 2020 -0800
+++ b/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java	Tue Jan 14 11:06:03 2020 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
 import jdk.internal.access.SharedSecrets;
 import jdk.internal.misc.ExtendedMapMode;
 import jdk.internal.misc.Unsafe;
+import jdk.internal.misc.VM;
 import jdk.internal.ref.Cleaner;
 import jdk.internal.ref.CleanerFactory;
 
@@ -1116,8 +1117,11 @@
     }
 
     private boolean isSync(MapMode mode) {
-        return mode == ExtendedMapMode.READ_ONLY_SYNC ||
-                mode == ExtendedMapMode.READ_WRITE_SYNC;
+        // Do not want to initialize ExtendedMapMode until
+        // after the module system has been initialized
+        return !VM.isModuleSystemInited() ? false :
+            (mode == ExtendedMapMode.READ_ONLY_SYNC ||
+                mode == ExtendedMapMode.READ_WRITE_SYNC);
     }
 
     private int toProt(MapMode mode) {