Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

When complete not working in completion Stage

Hi,
I am using the following code..
 
dao.update(table, rblKycRequestDetailsJsonObject).whenComplete((__,_1)->{
      System.out.println("xyz");
    });

Open in new window

And executed it.
But the string xyz is not getting printed in the console.
As per what i read whenComplete will get executed in both cases when the future completes
normally or exceptionally.

This is the update function in dao :
 
public CompletionStage<Integer> update(Table table, JsonObject jsonObject) {
    logger.debug("Inserting data in generic dao")
        .attr("table", table)
        .attr("jsonObject", jsonObject)
        .log();

    return getPostgresInstruction(table, jsonObject)
        .thenCompose(postgresInstruction -> update(postgresInstruction));
  }

Open in new window


Thanks
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial