I have a Collection of Objects. I have to call a method on this collections of objects which returns a Future. Right now I use the get()
on the Future so that it make the operation Synchronous. How can I convert it to Async?
for (Summary summary : summaries) {
acmResponseFuture(summary.getClassification()));
String classification = summary.getClassification();
// this is a call which return Future and which is a sync call now
AcmResponse acmResponse = acmResponseFuture(classification).get();
if (acmResponse != null && acmResponse.getAcmInfo() != null) {
summary.setAcm(mapper.readValue(acmResponse.getAcmInfo().getAcm(), Object.class));
}
summary.setDataType(DATA_TYPE);
summary.setApplication(NAME);
summary.setId(summary.getEntityId());
summary.setApiRef(federatorConfig.getqApiRefUrl() + summary.getEntityId());
}