@Test
  public void testRequestTTLDisabled() throws Exception {
    Configuration configuration = m_injector.getInstance(Configuration.class);
    configuration.setProperty(
        Configuration.METRIC_RETRIEVAL_SERVICE_REQUEST_TTL_ENABLED.getKey(), "false");

    InputStream jmxInputStream = IOUtils.toInputStream("{ \"beans\": [] }");

    // allow 100 calls to the mock exactly
    StreamProvider streamProvider = createStrictMock(StreamProvider.class);
    EasyMock.expect(streamProvider.readFrom(JMX_URL)).andReturn(jmxInputStream).times(100);

    replayAll();

    m_service.startAsync();
    m_service.awaitRunning(METRICS_SERVICE_TIMEOUT, TimeUnit.SECONDS);

    // make the service synchronous
    m_service.setThreadPoolExecutor(new SynchronousThreadPoolExecutor());

    // make 100 requests in rapid succession to the same URL
    for (int i = 0; i < 100; i++) {
      m_service.submitRequest(MetricSourceType.JMX, streamProvider, JMX_URL);
    }

    verifyAll();
  }
Tests that disabling the request TTL allows subsequent requests for the
same resource.
ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java