There is an asynchronous construction. I would like to continue processing after reading from the database here. I tried to use the "while" cycle as follows, but it didn't. Endless loop. If there is no "while" loop, it is asynchronous, but it doesn't work for me.
private XmlOperations fetchAttributeFromDB(RequestContext context,
XmlOperations invCnclAttributes,String orderId) {
String strSQL = "select bankStan,bankBatch,provBank from transactionHistory where orderId='"+orderId+"' limit 1";
DBClientService dbClientService = DBClientService.getService(context);
try {
Future<List<JsonArray>> futureHistory = dbClientService.ExecuteQuery(strSQL);
futureHistory.setHandler(sqlResult -> {
List<JsonArray> result = futureHistory.result();
invCnclAttributes.addAttribute("bankStan", result.get(0).getString(0));
invCnclAttributes.addAttribute("bankBatch", result.get(0).getString(1));
invCnclAttributes.addAttribute("provBank", result.get(0).getString(2));
futureHistory.complete();
});
while(!futureHistory.isComplete());
}catch(Exception e){
e.printStackTrace();
}
return invCnclAttributes;
}