When complete not working in completion Stage

Rohit Bajaj
Rohit Bajaj used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2018
Commented:
What happens if you add an .exceptionally call?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial