3636import java .util .stream .Collectors ;
3737import java .util .stream .IntStream ;
3838
39- public class App extends AbstractVerticle implements Handler <HttpServerRequest > {
39+ public class App extends VerticleBase implements Handler <HttpServerRequest > {
4040
4141 private static final int NUM_PROCESSORS = Runtime .getRuntime ().availableProcessors ();
4242 private static final org .slf4j .Logger log = org .slf4j .LoggerFactory .getLogger (App .class );
@@ -147,7 +147,7 @@ private MultiMap jsonHeaders() {
147147 }
148148
149149 @ Override
150- public void start ( Promise < Void > startPromise ) throws Exception {
150+ public Future <?> start ( ) throws Exception {
151151 int port = 8080 ;
152152 server = vertx
153153 .createHttpServer (new HttpServerOptions ()
@@ -173,13 +173,11 @@ public void start(Promise<Void> startPromise) throws Exception {
173173 options .setPreparedStatementCacheMaxSize (1024 );
174174 options .setPipeliningLimit (256 ); // Large pipelining means less flushing and we use a single connection anyway
175175 Future <?> clientsInit = initClients (options );
176- clientsInit
176+ return clientsInit
177177 .transform (ar -> {
178178 databaseErr = ar .cause ();
179179 return server .listen (port );
180- })
181- .<Void >mapEmpty ()
182- .onComplete (startPromise );
180+ });
183181 }
184182
185183 private Future <?> initClients (PgConnectOptions options ) {
@@ -275,8 +273,8 @@ public void handle(HttpServerRequest request) {
275273 }
276274
277275 @ Override
278- public void stop () {
279- if ( server != null ) server .close ();
276+ public Future <?> stop () throws Exception {
277+ return server != null ? server .close () : super . stop ();
280278 }
281279
282280 private void sendError (HttpServerRequest req , Throwable cause ) {
@@ -338,7 +336,7 @@ public Queries(HttpServerRequest req) {
338336 }
339337
340338 private void handle () {
341- client .group (c -> {
339+ client .group (/*queries, */ c -> {
342340 for (int i = 0 ; i < queries ; i ++) {
343341 c .preparedQuery (SELECT_WORLD )
344342 .execute (Tuple .of (boxedRandomWorldNumber ()))
@@ -385,7 +383,7 @@ public Update(HttpServerRequest request) {
385383 }
386384
387385 public void handle () {
388- client .group (c -> {
386+ client .group (/*worldsToUpdate.length, */ c -> {
389387 final PreparedQuery <RowSet <Row >> preparedQuery = c .preparedQuery (App .SELECT_WORLD );
390388 for (int i = 0 ; i < worldsToUpdate .length ; i ++) {
391389 final Integer id = boxedRandomWorldNumber ();
0 commit comments