pre-module refactor

This commit is contained in:
Relism
2026-03-15 02:04:36 +01:00
parent 79e4578731
commit f1beb160aa
3 changed files with 14 additions and 8 deletions
+7 -4
View File
@@ -7,10 +7,7 @@
<groupId>dev.relism</groupId>
<artifactId>Flash</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>flash-bench</module>
</modules>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>21</maven.compiler.source>
@@ -57,6 +54,12 @@
<version>2.0.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.42</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
+1 -2
View File
@@ -63,12 +63,11 @@ public class HttpServer {
* when the accept loop is running and the server is ready to serve requests.
*/
public CompletableFuture<Void> start() {
Thread.ofVirtual().name("flash-accept-loop").start(this::run);
Thread.ofPlatform().name("flash-accept-loop").daemon(false).start(this::run);
return readyFuture;
}
private void run() {
log.info("Server started on port {}", configuration.getPort());
try (executorService) {
readyFuture.complete(null);
while (!stopped) {
+6 -2
View File
@@ -4,11 +4,15 @@ import dev.relism.http.ContentType;
import dev.relism.models.*;
import dev.relism.routing.Route;
import dev.relism.routing.routers.fastpathrouter.FastPathRouterImpl;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
@Slf4j
public class Main {
private static final int PORT = 8080;
/*
@Route(method = "GET", path = "/profile")
public static class ProfileHandler extends RequestHandler {
@@ -21,7 +25,7 @@ public class Main {
public static void main(String[] args) throws IOException {
HttpServerConfiguration config = HttpServerConfiguration.builder()
.port(8080)
.port(PORT)
.host("localhost")
.build();
@@ -36,6 +40,6 @@ public class Main {
throw new RuntimeException(req.getQueryParam("test"));
});
server.start().thenRun(() -> System.out.println("Flash running on :" + config.getPort()));
server.start().thenRun(() -> log.info("Server started on port: " + PORT));
}
}