diff --git a/vertx-core/src/main/asciidoc/index.adoc b/vertx-core/src/main/asciidoc/index.adoc index ffc69f956ef..e3e9e998be4 100644 --- a/vertx-core/src/main/asciidoc/index.adoc +++ b/vertx-core/src/main/asciidoc/index.adoc @@ -322,15 +322,15 @@ will automatically stop any running server when the verticle is un-deployed. === What happened to Vert.x 4 Verticle and AbstractVerticle contracts? -The contract defined by `Verticle` and `AbstractVerticle` was not adapted anymore to Vert.x 5 future based model +The contract defined by `Verticle` and `AbstractVerticle` wasn't convenient anymore with Vert.x 5 future based model: [source,java] ---- {@link examples.CoreExamples#verticleContract} ---- -`Verticle` and `AbstractVerticle` are not deprecated in Vert.x 5 and it is fine to use them, however it is not the default -recommended choice anymore. +Nevertheless, `Verticle` and `AbstractVerticle` are not deprecated in Vert.x 5. +It is fine to use them, however it is not the default recommended choice anymore. === Verticle Types diff --git a/vertx-core/src/main/java/examples/NetExamples.java b/vertx-core/src/main/java/examples/NetExamples.java index 9464a2263df..dfdca83a50f 100755 --- a/vertx-core/src/main/java/examples/NetExamples.java +++ b/vertx-core/src/main/java/examples/NetExamples.java @@ -12,7 +12,10 @@ package examples; import io.netty.handler.logging.ByteBufFormat; -import io.vertx.core.*; +import io.vertx.core.DeploymentOptions; +import io.vertx.core.Future; +import io.vertx.core.VerticleBase; +import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.ClientAuth; import io.vertx.core.http.HttpServer; @@ -172,12 +175,12 @@ public void example10(NetSocket socket) { public void example11(Vertx vertx) { - class MyVerticle extends AbstractVerticle { + class MyVerticle extends VerticleBase { NetServer server; @Override - public void start() throws Exception { + public Future start() { server = vertx.createNetServer(); server.connectHandler(socket -> { socket.handler(buffer -> { @@ -185,7 +188,7 @@ public void start() throws Exception { socket.write(buffer); }); }); - server.listen(1234, "localhost"); + return server.listen(1234, "localhost"); } }