Skip to content

Commit

Permalink
Merge pull request #40682 from ia3andy/improve-runtime-update
Browse files Browse the repository at this point in the history
Allow to asynchronously notify extensions of no-restart changes
  • Loading branch information
ia3andy authored May 17, 2024
2 parents ec4f609 + bf266dc commit d77ee69
Showing 1 changed file with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,11 @@ public Throwable getDeploymentProblem() {
@Override
public void setRemoteProblem(Throwable throwable) {
compileProblem = throwable;
getCompileOutput().setMessage(throwable.getMessage());
if (throwable == null) {
getCompileOutput().setMessage(null);
} else {
getCompileOutput().setMessage(throwable.getMessage());
}
}

private StatusLine getCompileOutput() {
Expand Down Expand Up @@ -561,9 +565,7 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) {
return true;
} else if (!filesChanged.isEmpty()) {
try {
for (Consumer<Set<String>> consumer : noRestartChangesConsumers) {
consumer.accept(filesChanged);
}
notifyExtensions(filesChanged);
hotReloadProblem = null;
getCompileOutput().setMessage(null);
} catch (Throwable t) {
Expand All @@ -585,6 +587,30 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) {
}
}

/**
* This notifies registered extensions of "no-restart" changed files.
*
* @param noRestartChangedFiles the Set of changed files
*/
public void notifyExtensions(Set<String> noRestartChangedFiles) {
if (lastStartIndex == null) {
// we don't notify extensions if the application never started
return;
}
scanLock.lock();
codeGenLock.lock();
try {

for (Consumer<Set<String>> consumer : noRestartChangesConsumers) {
consumer.accept(noRestartChangedFiles);
}
} finally {
scanLock.unlock();
codeGenLock.unlock();
}

}

public boolean instrumentationEnabled() {
if (instrumentationEnabled != null) {
return instrumentationEnabled;
Expand Down

0 comments on commit d77ee69

Please sign in to comment.