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

fix: revert changes made for resolving start-stop issue #9915

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
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 @@ -35,7 +35,6 @@
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BiConsumer;
Expand Down Expand Up @@ -153,28 +152,14 @@ private DevModeHandler(Lookup lookup, int runningPort, File npmFolder,
reuseDevServer = config.reuseDevServer();
devServerPortFile = getDevServerPortFile(npmFolder);

/*
* Check whether executor is provided by the caller (framework). It
* doesn't matter which Executor to use: any is fine. The main reason to
* use managed executor is to stop the execution when the framework
* stops.
*/
Executor service = lookup.lookupAll(Executor.class).stream().findFirst()
.orElse(null);

BiConsumer<Void, ? super Throwable> action = (value, exception) -> {
// this will throw an exception if an exception has been thrown by
// the waitFor task
waitFor.getNow(null);
runOnFutureComplete(config);
};

if (service == null) {
devServerStartFuture = waitFor.whenCompleteAsync(action);
} else {
// if there is an executor use it to run the task
devServerStartFuture = waitFor.whenCompleteAsync(action, service);
}
devServerStartFuture = waitFor.whenCompleteAsync(action);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -388,25 +387,10 @@ public static void initDevModeHandler(Set<Class<?>> classes,
.withEmbeddableWebComponents(true).enablePnpm(enablePnpm)
.withHomeNodeExecRequired(useHomeNodeExec).build();

/*
* Check whether executor is provided by the caller (framework). It
* doesn't matter which Executor to use: any is fine. The main reason to
* use managed executor is to stop the execution when the framework
* stops.
*/
Executor service = lookup.lookupAll(Executor.class).stream().findFirst()
.orElse(null);

Runnable runnable = () -> runNodeTasks(context, tokenFileData,
tasks);

CompletableFuture<Void> nodeTasksFuture;
if (service == null) {
nodeTasksFuture = CompletableFuture.runAsync(runnable);
} else {
// if there is an executor use it to run the task
nodeTasksFuture = CompletableFuture.runAsync(runnable, service);
}
Runnable runnable = () -> runNodeTasks(context, tokenFileData, tasks);

CompletableFuture<Void> nodeTasksFuture = CompletableFuture
.runAsync(runnable);

DevModeHandler.start(
Lookup.compose(lookup,
Expand Down