@Test(timeout = 40000)
  public void testDeadlockWhileMappingHostsWithExistingServices()
      throws Exception {
    Provider<ClustersHostAndComponentMapperThread> clustersHostAndComponentMapperThreadFactory =
        new Provider<ClustersHostAndComponentMapperThread>() {

      @Override
      public ClustersHostAndComponentMapperThread get() {
        return new ClustersHostAndComponentMapperThread();
      }
    };

    doLoadTest(new ClusterReaderThreadFactory(),
        clustersHostAndComponentMapperThreadFactory,
        NUMBER_OF_THREADS,
        writerStoppedSignal,
        readerStoppedSignal);
  }
Tests that no deadlock exists when adding hosts while reading from the
cluster. This test ensures that there are service components installed on
the hosts so that the cluster health report does some more work.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java