public void prepare() {
        try {
            metricsConsumer = (IClusterMetricsConsumer) Class.forName(consumerClassName).newInstance();
            metricsConsumer.prepare(registrationArgument);
        } catch (Exception e) {
            LOG.error("Could not instantiate or prepare Cluster Metrics Consumer with fully qualified name "
                    + consumerClassName,
                    e);

            if (metricsConsumer != null) {
                metricsConsumer.cleanup();
            }
            metricsConsumer = null;
        }
    }
@Test
    public void testPrepareDoesNotThrowExceptionWhenInitializingClusterMetricsConsumerIsFailing() {
        ClusterMetricsConsumerExecutor sut = new ClusterMetricsConsumerExecutor(
            MockFailingClusterMetricsConsumer.class.getName(), 2);

        // it shouldn't propagate any exceptions
        sut.prepare();
        sut.prepare();

        assertEquals(2, MockFailingClusterMetricsConsumer.getPrepareCallCount());
    }