src/java.base/share/classes/sun/misc/ManagedLocalsThread.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke

@@ -28,11 +28,11 @@
 /**
  * A thread that has it's thread locals, and inheritable thread
  * locals erased on construction.
  */
 public class ManagedLocalsThread extends Thread {
-    private static final Unsafe UNSAFE;
+    private static final jdk.internal.misc.Unsafe UNSAFE;
     private static final long THREAD_LOCALS;
     private static final long INHERITABLE_THREAD_LOCALS;
 
     public ManagedLocalsThread() {
         eraseThreadLocals();

@@ -75,11 +75,11 @@
         UNSAFE.putObject(this, THREAD_LOCALS, null);
         UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null);
     }
 
     static {
-        UNSAFE = Unsafe.getUnsafe();
+        UNSAFE = jdk.internal.misc.Unsafe.getUnsafe();
         Class<?> t = Thread.class;
         try {
             THREAD_LOCALS = UNSAFE.objectFieldOffset
                 (t.getDeclaredField("threadLocals"));
             INHERITABLE_THREAD_LOCALS = UNSAFE.objectFieldOffset