@Override public void run() { if (LOG.isTraceEnabled()) { LOG.trace("Clearing JMX mbean cache."); } // This is pretty extreme but it's the best way that // I could find to get metrics to be removed. try { if (DefaultMetricsSystem.instance() != null) { DefaultMetricsSystem.instance().stop(); // Sleep some time so that the rest of the hadoop metrics // system knows that things are done Thread.sleep(500); DefaultMetricsSystem.instance().start(); } } catch (Exception exception) { LOG.debug("error clearing the jmx it appears the metrics system hasn't been started", exception); } } }
@Override public void run() { if (LOG.isTraceEnabled()) { LOG.trace("Clearing JMX mbean cache."); } // This is pretty extreme but it's the best way that // I could find to get metrics to be removed. try { if (DefaultMetricsSystem.instance() != null) { DefaultMetricsSystem.instance().stop(); // Sleep some time so that the rest of the hadoop metrics // system knows that things are done Thread.sleep(500); DefaultMetricsSystem.instance().start(); } } catch (Exception exception) { LOG.debug("error clearing the jmx it appears the metrics system hasn't been started", exception); } } }
@Override public void run() { if (LOG.isTraceEnabled()) { LOG.trace("Clearing JMX mbean cache."); } // This is pretty extreme but it's the best way that // I could find to get metrics to be removed. try { if (DefaultMetricsSystem.instance() != null) { DefaultMetricsSystem.instance().stop(); // Sleep some time so that the rest of the hadoop metrics // system knows that things are done Thread.sleep(500); DefaultMetricsSystem.instance().start(); } } catch (Exception exception) { LOG.debug("error clearing the jmx it appears the metrics system hasn't been started", exception); } } }
@Override public void run() { if (LOG.isTraceEnabled()) { LOG.trace("Clearing JMX mbean cache."); } // This is pretty extreme but it's the best way that // I could find to get metrics to be removed. try { if (DefaultMetricsSystem.instance() != null) { DefaultMetricsSystem.instance().stop(); // Sleep some time so that the rest of the hadoop metrics // system knows that things are done Thread.sleep(500); DefaultMetricsSystem.instance().start(); } } catch (Exception exception) { LOG.debug("error clearing the jmx it appears the metrics system hasn't been started", exception); } } }
@Test public void testMetricsCache() { MetricsSystem ms = new MetricsSystemImpl("cache"); ms.start(); try { String p1 = "root1"; String leafQueueName = "root1.leaf"; QueueMetrics p1Metrics = QueueMetrics.forQueue(ms, p1, null, true, conf); Queue parentQueue1 = mock(Queue.class); when(parentQueue1.getMetrics()).thenReturn(p1Metrics); QueueMetrics metrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf); Assert.assertNotNull("QueueMetrics for A shoudn't be null", metrics); // Re-register to check for cache hit, shouldn't blow up metrics-system... // also, verify parent-metrics QueueMetrics alterMetrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf); Assert.assertNotNull("QueueMetrics for alterMetrics shoudn't be null", alterMetrics); } finally { ms.shutdown(); } }
@Test public void testMetricsCache() { MetricsSystem ms = new MetricsSystemImpl("cache"); ms.start(); try { String p1 = "root1"; String leafQueueName = "root1.leaf"; QueueMetrics p1Metrics = QueueMetrics.forQueue(ms, p1, null, true, conf); Queue parentQueue1 = make(stub(Queue.class).returning(p1Metrics). from.getMetrics()); QueueMetrics metrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf); Assert.assertNotNull("QueueMetrics for A shoudn't be null", metrics); // Re-register to check for cache hit, shouldn't blow up metrics-system... // also, verify parent-metrics QueueMetrics alterMetrics = QueueMetrics.forQueue(ms, leafQueueName, parentQueue1, true, conf); Assert.assertNotNull("QueueMetrics for alterMetrics shoudn't be null", alterMetrics); } finally { ms.shutdown(); } }