Skip to content

Commit

Permalink
Use cached thread pool instead of virtual threads for compatibility r…
Browse files Browse the repository at this point in the history
…easons
  • Loading branch information
sleipnir committed Aug 28, 2023
1 parent a97a9f9 commit 7ef6665
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/io/eigr/spawn/Spawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
import io.eigr.spawn.internal.client.OkHttpSpawnClient;
import io.eigr.spawn.internal.client.SpawnClient;
import io.eigr.spawn.internal.handlers.ActorServiceHandler;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -75,7 +77,8 @@ public ActorRef createActorRef(String system, String name, String parent) {
private void startServer() throws IOException {
HttpServer httpServer = HttpServer.create(new InetSocketAddress(this.port), 0);
httpServer.createContext("/api/v1/actors/actions", new ActorServiceHandler(this.system, this.entities));
httpServer.setExecutor(Executors.newVirtualThreadPerTaskExecutor());
//httpServer.setExecutor(Executors.newVirtualThreadPerTaskExecutor());
httpServer.setExecutor(Executors.newCachedThreadPool());
httpServer.start();
}

Expand Down

0 comments on commit 7ef6665

Please sign in to comment.