Skip to content

Commit

Permalink
Fix asyncResult handling
Browse files Browse the repository at this point in the history
  • Loading branch information
amdelamar committed Dec 14, 2017
1 parent 01b762f commit 7892bea
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cloudfoundry-example/src/main/java/hello/MainVerticle.java
Expand Up @@ -52,14 +52,13 @@ public void start(Future<Void> startFuture) throws Exception {
httpServer.requestHandler(mainRouter::accept);

// Start listening
httpServer.listen(PORT, handler -> {
if (handler.succeeded()) {
httpServer.listen(PORT, asyncResult -> {
if (asyncResult.succeeded()) {
logger.info("Listening on port: " + PORT);
startFuture.complete();
} else {
String errorMessage = "Failed to bind on port " + PORT + ". Is it being used?";
logger.error(errorMessage);
startFuture.fail(errorMessage);
logger.error("Failed to bind on port " + PORT + ". Is it being used?");
startFuture.fail(asyncResult.cause());
}
});
}
Expand Down

0 comments on commit 7892bea

Please sign in to comment.