public static void stop() {
   ReferenceQueueDaemon.INSTANCE.stop();
   FinalizerDaemon.INSTANCE.stop();
   FinalizerWatchdogDaemon.INSTANCE.stop();
   HeapTrimmerDaemon.INSTANCE.stop();
   GCDaemon.INSTANCE.stop();
 }
 private static void finalizerTimedOut(Object object) {
   // The current object has exceeded the finalization deadline; abort!
   String message =
       object.getClass().getName()
           + ".finalize() timed out after "
           + (MAX_FINALIZE_NANOS / NANOS_PER_SECOND)
           + " seconds";
   Exception syntheticException = new TimeoutException(message);
   // We use the stack from where finalize() was running to show where it was stuck.
   syntheticException.setStackTrace(FinalizerDaemon.INSTANCE.getStackTrace());
   Thread.UncaughtExceptionHandler h = Thread.getDefaultUncaughtExceptionHandler();
   if (h == null) {
     // If we have no handler, log and exit.
     System.logE(message, syntheticException);
     System.exit(2);
   }
   // Otherwise call the handler to do crash reporting.
   // We don't just throw because we're not the thread that
   // timed out; we're the thread that detected it.
   h.uncaughtException(Thread.currentThread(), syntheticException);
 }