feature/render-binary #1

Merged
manuel merged 4 commits from feature/render-binary into master 2022-02-02 02:19:26 +01:00
3 changed files with 14 additions and 6 deletions
Showing only changes of commit 251baca8e2 - Show all commits

View file

@ -15,6 +15,7 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<properties> <properties>
<logback.version>1.2.10</logback.version>
<slf4j.version>1.7.35</slf4j.version> <slf4j.version>1.7.35</slf4j.version>
</properties> </properties>
@ -22,7 +23,7 @@
<dependency> <dependency>
<groupId>ch.fritteli.labyrinth</groupId> <groupId>ch.fritteli.labyrinth</groupId>
<artifactId>labyrinth-generator</artifactId> <artifactId>labyrinth-generator</artifactId>
<version>0.0.2-SNAPSHOT</version> <version>0.0.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.vavr</groupId> <groupId>io.vavr</groupId>
@ -44,7 +45,7 @@
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>1.2.10</version> <version>${logback.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>

View file

@ -27,7 +27,8 @@ import java.net.InetSocketAddress;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function; import java.util.function.Function;
@ -37,7 +38,13 @@ public class LabyrinthServer {
@NonNull @NonNull
private final HttpServer httpServer; private final HttpServer httpServer;
@NonNull @NonNull
private final ExecutorService executorService = Executors.newCachedThreadPool(); private final ExecutorService executorService = new ThreadPoolExecutor(
0,
1_000,
5,
TimeUnit.SECONDS,
new SynchronousQueue<>()
);
public LabyrinthServer(@NonNull final ServerConfig config) throws IOException, URISyntaxException { public LabyrinthServer(@NonNull final ServerConfig config) throws IOException, URISyntaxException {
this.httpServer = HttpServer.create(new InetSocketAddress(config.getAddress(), config.getPort()), 5); this.httpServer = HttpServer.create(new InetSocketAddress(config.getAddress(), config.getPort()), 5);

View file

@ -4,7 +4,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
@ -12,7 +11,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class ServerConfigTest { class ServerConfigTest {
@BeforeEach @BeforeEach
void clearSysProperties() { void clearSysProperties() {
System.setProperties(new Properties()); System.clearProperty(ServerConfig.SYSPROP_HOST);
System.clearProperty(ServerConfig.SYSPROP_PORT);
} }
@Test @Test