pre-module refactor
This commit is contained in:
@@ -7,10 +7,7 @@
|
|||||||
<groupId>dev.relism</groupId>
|
<groupId>dev.relism</groupId>
|
||||||
<artifactId>Flash</artifactId>
|
<artifactId>Flash</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>jar</packaging>
|
||||||
<modules>
|
|
||||||
<module>flash-bench</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
<maven.compiler.source>21</maven.compiler.source>
|
||||||
@@ -57,6 +54,12 @@
|
|||||||
<version>2.0.16</version>
|
<version>2.0.16</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.42</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -63,12 +63,11 @@ public class HttpServer {
|
|||||||
* when the accept loop is running and the server is ready to serve requests.
|
* when the accept loop is running and the server is ready to serve requests.
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Void> start() {
|
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;
|
return readyFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void run() {
|
private void run() {
|
||||||
log.info("Server started on port {}", configuration.getPort());
|
|
||||||
try (executorService) {
|
try (executorService) {
|
||||||
readyFuture.complete(null);
|
readyFuture.complete(null);
|
||||||
while (!stopped) {
|
while (!stopped) {
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ import dev.relism.http.ContentType;
|
|||||||
import dev.relism.models.*;
|
import dev.relism.models.*;
|
||||||
import dev.relism.routing.Route;
|
import dev.relism.routing.Route;
|
||||||
import dev.relism.routing.routers.fastpathrouter.FastPathRouterImpl;
|
import dev.relism.routing.routers.fastpathrouter.FastPathRouterImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
|
private static final int PORT = 8080;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Route(method = "GET", path = "/profile")
|
@Route(method = "GET", path = "/profile")
|
||||||
public static class ProfileHandler extends RequestHandler {
|
public static class ProfileHandler extends RequestHandler {
|
||||||
@@ -21,7 +25,7 @@ public class Main {
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
HttpServerConfiguration config = HttpServerConfiguration.builder()
|
HttpServerConfiguration config = HttpServerConfiguration.builder()
|
||||||
.port(8080)
|
.port(PORT)
|
||||||
.host("localhost")
|
.host("localhost")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -36,6 +40,6 @@ public class Main {
|
|||||||
throw new RuntimeException(req.getQueryParam("test"));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user