private List<Metric> getMetrics(String name, Future<List<Metric>> future) { List<Metric> metrics = EMPTY; try { metrics = future.get(timeout, TimeUnit.MILLISECONDS); } catch (ExecutionException e) { increment(e, name); LOGGER.warn("uncaught exception from poll method for " + name, e); } catch (TimeoutException e) { // The cancel is needed to prevent the slow task from using up all threads future.cancel(true); increment(e, name); LOGGER.warn("timeout executing poll method for " + name, e); } catch (InterruptedException e) { increment(e, name); LOGGER.warn("interrupted while doing get for " + name, e); } return metrics; }
private List<Metric> getMetrics(String name, Future<List<Metric>> future) { List<Metric> metrics = EMPTY; try { metrics = future.get(timeout, TimeUnit.MILLISECONDS); } catch (ExecutionException e) { increment(e, name); LOGGER.warn("uncaught exception from poll method for " + name, e); } catch (TimeoutException e) { // The cancel is needed to prevent the slow task from using up all threads future.cancel(true); increment(e, name); LOGGER.warn("timeout executing poll method for " + name, e); } catch (InterruptedException e) { increment(e, name); LOGGER.warn("interrupted while doing get for " + name, e); } return metrics; }