void (boolean now) { Set<VirtualFile> files; long startedAt; boolean fromRoot; boolean restart = false; synchronized (reference) { files = reference.get(); if (files == null) { LOG.debug("updating queue was already flushed @ ", invoker); return; } startedAt = time; fromRoot = root; if (fromRoot) { root = false; reference.set(null); } else if (now || size == files.size()) { reference.set(null); } else { restart = true; } } if (restart) { LOG.debug("continue collecting files to update @ ", invoker); invoker.invokeLater(() -> onInvokerThread(false), getUpdatingDelay()); } else { LOG.debug("spent ", System.currentTimeMillis() - startedAt, "ms to collect ", size, " files to update @ ", invoker); invoker.invoke(() -> updateStructure(fromRoot, files)); } }