Skip to content

Commit

Permalink
jooby-run: Hot reloading not working when .class file is changed by e…
Browse files Browse the repository at this point in the history
…xternal process

- unload module on .class file changed
- fix #3505
  • Loading branch information
jknack committed Aug 19, 2024
1 parent d2f41dd commit c4744a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/jooby-run/src/main/java/io/jooby/run/JoobyRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ private synchronized void actualRestart() {
var unload = false;
Supplier<Boolean> compileTask = null;
for (; e != null && (t - e.time) > waitTimeBeforeRestartMillis; e = queue.peek()) {
unload = unload || options.isCompileExtension(e.path);
// unload on source code changes (.java, .kt) or binary changes (.class)
unload = unload || options.isCompileExtension(e.path) || options.isClass(e.path);
compileTask = Optional.ofNullable(compileTask).orElse(e.compileTask);
queue.poll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ public boolean isCompileExtension(Path path) {
return containsExtension(compileExtensions, path);
}

public boolean isClass(Path path) {
return containsExtension(List.of("class"), path);
}

/**
* Test if the given path matches a restart extension.
*
Expand Down

0 comments on commit c4744a0

Please sign in to comment.