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

Remove unused ExecutorService init/termination #419

Merged
merged 2 commits into from
Feb 22, 2020
Merged
Changes from 1 commit
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 @@ -53,9 +53,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import io.vertx.core.Vertx;
Expand All @@ -68,7 +65,6 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {

private final Logger LOG = LogManager.getLogger();
private final Map<String, Runner> besuRunners = new HashMap<>();
private ExecutorService nodeExecutor = Executors.newCachedThreadPool();

private final Map<Node, BesuPluginContextImpl> besuPluginContextMap = new HashMap<>();

Expand Down Expand Up @@ -102,9 +98,6 @@ private BesuPluginContextImpl buildPluginContext(

@Override
public void startNode(final BesuNode node) {
if (nodeExecutor == null || nodeExecutor.isShutdown()) {
nodeExecutor = Executors.newCachedThreadPool();
}

final StorageServiceImpl storageService = new StorageServiceImpl();
final Path dataDir = node.homeDirectory();
Expand Down Expand Up @@ -221,14 +214,6 @@ public void shutdown() {

// iterate over a copy of the set so that besuRunner can be updated when a runner is killed
new HashSet<>(besuRunners.keySet()).forEach(this::killRunner);
try {
nodeExecutor.shutdownNow();
if (!nodeExecutor.awaitTermination(5, TimeUnit.SECONDS)) {
throw new IllegalStateException("Failed to shut down node executor");
}
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
}

@Override
Expand Down