Slide 20
Slide 20 text
© 2011 innoQ Deutschland GmbH
Parallele Abfrage
public Iterable search(String type) {
HystrixCommand com1 = new GetProductsFromMerchant1(type);
HystrixCommand com2 = new GetProductsFromMerchant2(type);
Future fut1 = com1.queue();
Future fut2 = com2.queue();
try {
List products1 = fut1.get();
List products2 = fut2.get();
return CollectionUtils.union(products1, products2);
} catch (InterruptedException | ExecutionException e) {
logger.error("unexpected exception", e);
return Collections.emptyList();
}
}