Skip to content

Commit

Permalink
Allow processors to notify extensions of no-restart changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ia3andy committed May 17, 2024
1 parent ee1d4ee commit 9f763bb
Showing 1 changed file with 27 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,27 @@ 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;
}
try {
scanLock.lock();
for (Consumer<Set<String>> consumer : noRestartChangesConsumers) {
consumer.accept(noRestartChangedFiles);
}
} finally {
scanLock.unlock();
}

}

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

0 comments on commit 9f763bb

Please sign in to comment.