Skip to content

Commit

Permalink
Log message on slow restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored and gsmet committed Apr 8, 2021
1 parent ecb6be6 commit 5938293
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
Expand Down Expand Up @@ -82,6 +83,8 @@ public class RuntimeUpdatesProcessor implements HotReplacementContext, Closeable
*/
private volatile boolean firstScanDone = false;

private static volatile boolean instrumentationLogPrinted = false;

private final Map<Path, Long> sourceFileTimestamps = new ConcurrentHashMap<>();
private final Map<Path, Long> watchedFileTimestamps = new ConcurrentHashMap<>();
private final Map<Path, Long> classFileChangeTimeStamps = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -255,7 +258,16 @@ public boolean doScan(boolean userInitiated) throws IOException {
|| (IsolatedDevModeMain.deploymentProblem != null && userInitiated) || configFileRestartNeeded);
if (restartNeeded) {
restartCallback.accept(filesChanged, changedClassResults);
log.infof("Hot replace total time: %ss ", Timing.convertToBigDecimalSeconds(System.nanoTime() - startNanoseconds));
long timeNanoSeconds = System.nanoTime() - startNanoseconds;
log.infof("Hot replace total time: %ss ", Timing.convertToBigDecimalSeconds(timeNanoSeconds));
if (TimeUnit.SECONDS.convert(timeNanoSeconds, TimeUnit.NANOSECONDS) >= 4 && !instrumentationEnabled()) {
if (!instrumentationLogPrinted) {
instrumentationLogPrinted = true;
log.info(
"Live reload took more than 4 seconds, you may want to enable instrumentation based reload (quarkus.live-reload.instrumentation=true). This allows small changes to take effect without restarting Quarkus.");
}
}

return true;
} else if (!filesChanged.isEmpty()) {
for (Consumer<Set<String>> consumer : noRestartChangesConsumers) {
Expand Down

0 comments on commit 5938293

Please sign in to comment.