Skip to content

Commit 01b762f

Browse files
committed
Fix link and Future complete
1 parent f6c0850 commit 01b762f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cloudfoundry-example/README.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
= Vert.x on Cloud Foundry
22

3-
This demo shows a very simple hello world Vert.x project for link:https://www.cloudfoundry.org/[Cloud Foundry]. It has a simple HTTP server which simply serves the /webroot/index.html.
3+
This demo shows a very simple hello world Vert.x project for link:https://www.cloudfoundry.org/[Cloud Foundry]. It has a simple HTTP server which simply serves the `/webroot/index.html`.
44

5-
This demo uses link:http://vertx.io/[Vert.x] and is packed using the official link:https://github.com/cloudfoundry/java-buildpack[CloudFoundry java-buildpack]. The `manifest.yml` specifies the app's memory to be 768MB because any lower and the java-buildpack throws an error that it can't allocate enough heap space. (See)
5+
This demo uses link:http://vertx.io/[Vert.x] and is packed using the official link:https://github.com/cloudfoundry/java-buildpack[CloudFoundry java-buildpack]. The `manifest.yml` specifies the app's memory to be 768MB because any lower and the java-buildpack throws an error that it can't allocate enough heap space. (See the link:https://www.cloudfoundry.org/certified-platforms/[list of certified platforms]).
66

77
The environment variable `PORT` is normally provided by your CloudFoundry service, and therefore can change when being deployed. Otherwise the default port is `8080`.
88

cloudfoundry-example/src/main/java/hello/MainVerticle.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public static void main(String[] args) {
3434

3535
@Override
3636
public void start(Future<Void> startFuture) throws Exception {
37-
super.start(startFuture);
3837

3938
// PORT env check
4039
try {
@@ -56,15 +55,18 @@ public void start(Future<Void> startFuture) throws Exception {
5655
httpServer.listen(PORT, handler -> {
5756
if (handler.succeeded()) {
5857
logger.info("Listening on port: " + PORT);
58+
startFuture.complete();
5959
} else {
60-
logger.error("Failed to bind on port " + PORT + ". Is it being used?");
60+
String errorMessage = "Failed to bind on port " + PORT + ". Is it being used?";
61+
logger.error(errorMessage);
62+
startFuture.fail(errorMessage);
6163
}
6264
});
6365
}
6466

6567
@Override
6668
public void stop(Future<Void> stopFuture) throws Exception {
67-
super.stop(stopFuture);
6869
logger.info("Stopped listening on port: " + PORT);
70+
stopFuture.complete();
6971
}
7072
}

0 commit comments

Comments
 (0)