< prev index next >

src/java.base/share/classes/java/util/concurrent/locks/LockSupport.java

Print this page
rev 17358 : 8182487: Add Unsafe.objectFieldOffset(Class, String)
Reviewed-by: dsimms

@@ -421,19 +421,14 @@
     private static final Unsafe U = Unsafe.getUnsafe();
     private static final long PARKBLOCKER;
     private static final long SECONDARY;
     private static final long TID;
     static {
-        try {
             PARKBLOCKER = U.objectFieldOffset
-                (Thread.class.getDeclaredField("parkBlocker"));
+            (Thread.class, "parkBlocker");
             SECONDARY = U.objectFieldOffset
-                (Thread.class.getDeclaredField("threadLocalRandomSecondarySeed"));
+            (Thread.class, "threadLocalRandomSecondarySeed");
             TID = U.objectFieldOffset
-                (Thread.class.getDeclaredField("tid"));
-
-        } catch (ReflectiveOperationException e) {
-            throw new Error(e);
-        }
+            (Thread.class, "tid");
     }
 
 }
< prev index next >