feature/undertow #4
2 changed files with 3 additions and 17 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue