private Object getValue(Monitor<?> monitor, boolean reset) { try { if (limiter != null) { final MonitorValueCallable c = new MonitorValueCallable(monitor); return limiter.callWithTimeout(c, 1, TimeUnit.SECONDS, true); } else { return monitor.getValue(); } } catch (UncheckedTimeoutException e) { LOGGER.warn("timeout trying to get value for {}", monitor.getConfig()); } catch (Exception e) { LOGGER.warn("failed to get value for " + monitor.getConfig(), e); } return null; }
public Object call() throws Exception { return monitor.getValue(); }