Skip to content

Commit c4744a0

Browse files
committed
jooby-run: Hot reloading not working when .class file is changed by external process
- unload module on .class file changed - fix #3505
1 parent d2f41dd commit c4744a0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

modules/jooby-run/src/main/java/io/jooby/run/JoobyRun.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ private synchronized void actualRestart() {
435435
var unload = false;
436436
Supplier<Boolean> compileTask = null;
437437
for (; e != null && (t - e.time) > waitTimeBeforeRestartMillis; e = queue.peek()) {
438-
unload = unload || options.isCompileExtension(e.path);
438+
// unload on source code changes (.java, .kt) or binary changes (.class)
439+
unload = unload || options.isCompileExtension(e.path) || options.isClass(e.path);
439440
compileTask = Optional.ofNullable(compileTask).orElse(e.compileTask);
440441
queue.poll();
441442
}

modules/jooby-run/src/main/java/io/jooby/run/JoobyRunOptions.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ public boolean isCompileExtension(Path path) {
171171
return containsExtension(compileExtensions, path);
172172
}
173173

174+
public boolean isClass(Path path) {
175+
return containsExtension(List.of("class"), path);
176+
}
177+
174178
/**
175179
* Test if the given path matches a restart extension.
176180
*

0 commit comments

Comments
 (0)