Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to asynchronously notify extensions of no-restart changes #40682

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
Comment on lines +600 to +601
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the new locks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the context, I want to make sure this won't cause problems as you asked for a backport.

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
Loading