< prev index next >

src/java.base/share/classes/java/util/concurrent/Phaser.java

Print this page
8197531: Miscellaneous changes imported from jsr166 CVS 2018-04
Reviewed-by: martin, psandoz


1120         }
1121 
1122         public boolean block() {
1123             while (!isReleasable()) {
1124                 if (timed)
1125                     LockSupport.parkNanos(this, nanos);
1126                 else
1127                     LockSupport.park(this);
1128             }
1129             return true;
1130         }
1131     }
1132 
1133     // VarHandle mechanics
1134     private static final VarHandle STATE;
1135     static {
1136         try {
1137             MethodHandles.Lookup l = MethodHandles.lookup();
1138             STATE = l.findVarHandle(Phaser.class, "state", long.class);
1139         } catch (ReflectiveOperationException e) {
1140             throw new Error(e);
1141         }
1142 
1143         // Reduce the risk of rare disastrous classloading in first call to
1144         // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
1145         Class<?> ensureLoaded = LockSupport.class;
1146     }
1147 }


1120         }
1121 
1122         public boolean block() {
1123             while (!isReleasable()) {
1124                 if (timed)
1125                     LockSupport.parkNanos(this, nanos);
1126                 else
1127                     LockSupport.park(this);
1128             }
1129             return true;
1130         }
1131     }
1132 
1133     // VarHandle mechanics
1134     private static final VarHandle STATE;
1135     static {
1136         try {
1137             MethodHandles.Lookup l = MethodHandles.lookup();
1138             STATE = l.findVarHandle(Phaser.class, "state", long.class);
1139         } catch (ReflectiveOperationException e) {
1140             throw new ExceptionInInitializerError(e);
1141         }
1142 
1143         // Reduce the risk of rare disastrous classloading in first call to
1144         // LockSupport.park: https://bugs.openjdk.java.net/browse/JDK-8074773
1145         Class<?> ensureLoaded = LockSupport.class;
1146     }
1147 }
< prev index next >