Source:
<code>public void addConnector(String connectorName, Connector connector, AssignmentStrategy strategy, boolean customCheckpointing, DatastreamDeduper deduper, String authorizerName) { Validate.notNull(strategy, "strategy cannot be null"); Validate.notEmpty(connectorName, "connectorName cannot be empty"); Validate.notNull(connector, "Connector cannot be null"); _log.info(String.format("Add new connector of type %s, strategy %s with custom checkpointing %s to coordinator", connectorName, strategy.getClass().getTypeName(), customCheckpointing)); if (_connectors.containsKey(connectorName)) { String err = "A connector of type " + connectorName + " already exists."; _log.error(err); throw new IllegalArgumentException(err); } Optional<List<BrooklinMetricInfo>> connectorMetrics = Optional.ofNullable(connector.getMetricInfos()); connectorMetrics.ifPresent(_metrics::addAll); ConnectorInfo connectorInfo = new ConnectorInfo(connectorName, connector, strategy, customCheckpointing, deduper, authorizerName); _connectors.put(connectorName, connectorInfo); Class<?> connectorClass = connector.getClass(); <START> _dynamicMetricsManager.registerGauge(connectorClass, NUM_DATASTREAMS, <END> () -> connectorInfo.getConnector().getNumDatastreams()); _dynamicMetricsManager.registerGauge(connectorClass, NUM_DATASTREAM_TASKS, () -> connectorInfo.getConnector().getNumDatastreamTasks()); String className = connectorClass.getSimpleName(); _metrics.add(new BrooklinGaugeInfo(MetricRegistry.name(className, NUM_DATASTREAMS))); _metrics.add(new BrooklinGaugeInfo(MetricRegistry.name(className, NUM_DATASTREAM_TASKS))); }</code><technical_language>instead of Class<?> connectorClass, assign class simple name a String that</technical_language>

Target:
public void addConnector(String connectorName, Connector connector, AssignmentStrategy strategy, boolean customCheckpointing, DatastreamDeduper deduper, String authorizerName) { Validate.notNull(strategy, "strategy cannot be null"); Validate.notEmpty(connectorName, "connectorName cannot be empty"); Validate.notNull(connector, "Connector cannot be null"); _log.info(String.format("Add new connector of type %s, strategy %s with custom checkpointing %s to coordinator", connectorName, strategy.getClass().getTypeName(), customCheckpointing)); if (_connectors.containsKey(connectorName)) { String err = "A connector of type " + connectorName + " already exists."; _log.error(err); throw new IllegalArgumentException(err); } Optional<List<BrooklinMetricInfo>> connectorMetrics = Optional.ofNullable(connector.getMetricInfos()); connectorMetrics.ifPresent(_metrics::addAll); ConnectorInfo connectorInfo = new ConnectorInfo(connectorName, connector, strategy, customCheckpointing, deduper, authorizerName); _connectors.put(connectorName, connectorInfo); String className = connector.getClass().getSimpleName(); _dynamicMetricsManager.registerGauge(className, NUM_DATASTREAMS, () -> connectorInfo.getConnector().getNumDatastreams()); _dynamicMetricsManager.registerGauge(className, NUM_DATASTREAM_TASKS, () -> connectorInfo.getConnector().getNumDatastreamTasks()); _metrics.add(new BrooklinGaugeInfo(MetricRegistry.name(className, NUM_DATASTREAMS))); _metrics.add(new BrooklinGaugeInfo(MetricRegistry.name(className, NUM_DATASTREAM_TASKS))); }