feature/undertow #4

Merged
manuel merged 15 commits from feature/undertow into master 2023-04-08 22:40:46 +02:00
2 changed files with 3 additions and 17 deletions
Showing only changes of commit 17afb42715 - Show all commits

View file

@ -25,14 +25,8 @@ public class LabyrinthServer {
@NonNull @NonNull
private final Undertow undertow; private final Undertow undertow;
public static Option<LabyrinthServer> createAndStartServer() { public static Try<LabyrinthServer> createAndStartServer() {
final Option<LabyrinthServer> serverOption = Try.of(ServerConfig::init) final Try<LabyrinthServer> serverOption = Try.of(ServerConfig::init).mapTry(LabyrinthServer::new);
.mapTry(LabyrinthServer::new)
.onFailure(cause -> log.error(
"Failed to create LabyrinthServer.",
cause
))
.toOption();
serverOption.forEach(LabyrinthServer::start); serverOption.forEach(LabyrinthServer::start);
return serverOption; return serverOption;
} }

View file

@ -5,14 +5,6 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
LabyrinthServer.createAndStartServer().onEmpty(() -> log.error("Failed to create server. Stopping.")); LabyrinthServer.createAndStartServer().onFailure(e -> log.error("Failed to create server. Stopping.", e));
// final ServerConfig config = ServerConfig.init();
// log.info("Starting Server at http://{}:{}/", config.getAddress().getHostAddress(), config.getPort());
// Undertow.builder()
// .addHttpListener(config.getPort(), config.getAddress().getHostAddress())
// .setHandler(UndertowPlayground.r)
// .build()
// .start();
} }
} }