@Test public void testRunPositive() throws Exception { HBaseTimelineMetricsService metricStore = createNiceMock(HBaseTimelineMetricsService.class); expect(metricStore.putMetricsSkipCache(anyObject(TimelineMetrics.class))) .andReturn(new TimelinePutResponse()); expect(metricStore.getTimelineMetrics(EasyMock.<List<String>>anyObject(), EasyMock.<List<String>>anyObject(), anyObject(String.class), anyObject(String.class), anyObject(Long.class), anyObject(Long.class), eq(Precision.SECONDS), eq(1), eq(true), anyObject(TopNConfig.class), anyString())) .andReturn(null).anyTimes(); mockStatic(ExitUtil.class); replay(metricStore); TimelineMetricStoreWatcher timelineMetricStoreWatcher = new TimelineMetricStoreWatcher(metricStore, TimelineMetricConfiguration.getInstance()); timelineMetricStoreWatcher.run(); timelineMetricStoreWatcher.run(); timelineMetricStoreWatcher.run(); verify(metricStore); }
@Override public void run() { if (checkMetricStore()) { failures = 0; if (LOG.isDebugEnabled()) { LOG.debug("Successfully got metrics from TimelineMetricStore"); } } else { LOG.info("Failed to get metrics from TimelineMetricStore, attempt = " + failures); failures++; } if (failures >= configuration.getTimelineMetricsServiceWatcherMaxFailures()) { String msg = "Error getting metrics from TimelineMetricStore. " + "Shutting down by TimelineMetricStoreWatcher."; LOG.fatal(msg); ExitUtil.terminate(-1, msg); } }
TimelineMetricStoreWatcher implements Runnable { @Override public void run() { if (checkMetricStore()) { failures = 0; if (LOG.isDebugEnabled()) { LOG.debug("Successfully got metrics from TimelineMetricStore"); } } else { LOG.info("Failed to get metrics from TimelineMetricStore, attempt = " + failures); failures++; } if (failures >= configuration.getTimelineMetricsServiceWatcherMaxFailures()) { String msg = "Error getting metrics from TimelineMetricStore. " + "Shutting down by TimelineMetricStoreWatcher."; LOG.fatal(msg); ExitUtil.terminate(-1, msg); } } }
TimelineMetricStoreWatcher implements Runnable { @Override public void run() { if (checkMetricStore()) { failures = 0; if (LOG.isDebugEnabled()) { LOG.debug("Successfully got metrics from TimelineMetricStore"); } } else { LOG.info("Failed to get metrics from TimelineMetricStore, attempt = " + failures); failures++; } if (failures >= configuration.getTimelineMetricsServiceWatcherMaxFailures()) { String msg = "Error getting metrics from TimelineMetricStore. " + "Shutting down by TimelineMetricStoreWatcher."; LOG.fatal(msg); ExitUtil.terminate(-1, msg); } } TimelineMetricStoreWatcher(HBaseTimelineMetricsService timelineMetricStore,
                                    TimelineMetricConfiguration configuration); }
TimelineMetricStoreWatcher implements Runnable { @Override public void run() { if (checkMetricStore()) { failures = 0; if (LOG.isDebugEnabled()) { LOG.debug("Successfully got metrics from TimelineMetricStore"); } } else { LOG.info("Failed to get metrics from TimelineMetricStore, attempt = " + failures); failures++; } if (failures >= configuration.getTimelineMetricsServiceWatcherMaxFailures()) { String msg = "Error getting metrics from TimelineMetricStore. " + "Shutting down by TimelineMetricStoreWatcher."; LOG.fatal(msg); ExitUtil.terminate(-1, msg); } } TimelineMetricStoreWatcher(HBaseTimelineMetricsService timelineMetricStore,
                                    TimelineMetricConfiguration configuration); @Override void run(); }
TimelineMetricStoreWatcher implements Runnable { @Override public void run() { if (checkMetricStore()) { failures = 0; if (LOG.isDebugEnabled()) { LOG.debug("Successfully got metrics from TimelineMetricStore"); } } else { LOG.info("Failed to get metrics from TimelineMetricStore, attempt = " + failures); failures++; } if (failures >= configuration.getTimelineMetricsServiceWatcherMaxFailures()) { String msg = "Error getting metrics from TimelineMetricStore. " + "Shutting down by TimelineMetricStoreWatcher."; LOG.fatal(msg); ExitUtil.terminate(-1, msg); } } TimelineMetricStoreWatcher(HBaseTimelineMetricsService timelineMetricStore,
                                    TimelineMetricConfiguration configuration); @Override void run();  }