オブジェクトのコレクションがあります。このオブジェクトのコレクションに対して、Future を返すメソッドを呼び出す必要があります。現在get()
、操作を同期させるために、Future を使用しています。どうすれば非同期に変換できますか?
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());
}