< prev index next >

src/java.base/share/classes/java/lang/ref/Finalizer.java

Print this page
@@ -33,11 +33,11 @@
  
  final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
                                                            same package as the Reference
                                                            class */
  
-     private static ReferenceQueue<Object> queue = new ReferenceQueue<>();
+     private static ReferenceQueue<Object> queue = new NativeReferenceQueue<>();
  
      /** Head of doubly linked list of Finalizers awaiting finalization. */
      private static Finalizer unfinalized = null;
  
      /** Lock guarding access to unfinalized list. */

@@ -111,10 +111,11 @@
      @SuppressWarnings("removal")
      private static void forkSecondaryFinalizer(final Runnable proc) {
          AccessController.doPrivileged(
              new PrivilegedAction<>() {
                  public Void run() {
+                     @SuppressWarnings("deprecation")
                      ThreadGroup tg = Thread.currentThread().getThreadGroup();
                      for (ThreadGroup tgn = tg;
                           tgn != null;
                           tg = tgn, tgn = tg.getParent());
                      Thread sft = new Thread(tg, proc, "Secondary finalizer", 0, false);

@@ -180,10 +181,11 @@
              }
          }
      }
  
      static {
+         @SuppressWarnings("deprecation")
          ThreadGroup tg = Thread.currentThread().getThreadGroup();
          for (ThreadGroup tgn = tg;
               tgn != null;
               tg = tgn, tgn = tg.getParent());
          Thread finalizer = new FinalizerThread(tg);
< prev index next >