code: public static void stopBackgroundThread(long timeoutMillis) {
          backgroundThreadMayRun = false;
          synchronized (fifo) {
              fifo.notify();
          }
          if ((backgroundThread != null) && (timeoutMillis > 0)) {
              try {
                  backgroundThread.join(timeoutMillis);
              } catch (InterruptedException e) {
              }
              backgroundThread = null;
          }
      }
docs: Stop the long-lived background thread.
  <p>
  This method is needed for debugging purposes only. Calling it in an application is not really
  required: The background thread will terminate automatically when the application exits.
  
  @param timeoutMillis  If nonzero, wait for thread completion before returning.