cescoffier / vertx-completable-future

An implementation of CompletableFuture for Vert.x
Apache License 2.0
78 stars 28 forks source link

from(Vertx, future).get() not returning.. #44

Open RangaSamudrala opened 4 years ago

RangaSamudrala commented 4 years ago

Hello I am trying to use to return the results of an action back to a legacy piece of code.

     io.vertx.core.Future<Response> future = performActionHandler.call(); 
    VertxCompletableFuture<Response> completablePerformActionResponse = VertxCompletableFuture.from(this.getVertx(), future);

     // wait synchronously for the response.
     Response response0 = completablePerformActionResponse.get();
     return response0;

In the above code, the "get()" method never receives the completion of the Future. So, the code hangs.

If I have a logic like below without VertxCompletableFuture, it works perfectly fine, but how to return "response0" ?

     future.setHandler(h0 -> { 
        Response response0 = null;
        if (h0.succeeded()) {
           response0 = h0.result();
        } else {
           response0 = createResponse(startTime, null, "failure", h0.cause().getMessage());
        } 
     });

In your test cases, I do not see use of from(..)->get(..) but use test the use of from(..)->theApply(..)..

Is there a problem with the implementation here and is not covered by unit test cases?

thanks Ranga