code: private synchronized void startWeakRefCleaner() {
          weakRefCleaner = new Thread(() -> {
              boolean running = true;
              while (running) {
                  try {
                      // just wait, no need to get the - gc'ed object
                      weakReferenceQueue.remove();
  
                      // clean up the coordinateLines entries
                      final Set<String> coordinateLinesToRemove = new HashSet<>();
                      synchronized (coordinateLines) {
                          coordinateLines.forEach((k, v) -> {
                              if (null == v.get()) {
                                  coordinateLinesToRemove.add(k);
                                  if (logger.isTraceEnabled()) {
                                      logger.trace("need to cleanup gc'ed coordinate line {}", k);
                                  }
                              }
                          });
                      }
                      // run on the JavaFX thread, as removeCoordinateLineWithId() calls methods from the WebView
                      Platform.runLater(() -> coordinateLinesToRemove.forEach(this::removeCoordinateLineWithId));
  
                      // clean up the MapCoordinateElement entries
                      final Set<String> mapCoordinateElementsToRemove = new HashSet<>();
                      synchronized (mapCoordinateElements) {
                          mapCoordinateElements.forEach((k, v) -> {
                              if (null == v.get()) {
                                  mapCoordinateElementsToRemove.add(k);
                                  if (logger.isTraceEnabled()) {
                                      logger.trace("need to cleanup gc'ed element {}", k);
                                  }
                              }
                          });
                      }
                      // run on the JavaFX thread, as removeCoordinateLineWithId() calls methods from the WebView
                      Platform.runLater(
                              () -> mapCoordinateElementsToRemove.forEach(this::removeMapCoordinateElementWithId));
                  } catch (InterruptedException e) {
                      if (logger.isDebugEnabled()) {
                          logger.debug("thread interrupted");
                      }
                      running = false;
                  }
              }
          });
          weakRefCleaner.setName("MapView-WeakRef-Cleaner");
          weakRefCleaner.setDaemon(true);
          weakRefCleaner.start();
      }
docs: defines and starts the thread watching the weak reference queue(s)