}
try {
StatusType newTopologyStatus = StatusType.activate;
// /ZK-DIR/topology
StormBase base = zkCluster.storm_base(topologyId, this);
if (base == null) {
// @@@ normally the topology has been removed
LOG.warn("Failed to get StromBase from ZK of " + topologyId);
newTopologyStatus = StatusType.killed;
} else {
newTopologyStatus = base.getStatus().getStatusType();
}
// Start metrics report if metrics monitor is enabled.
// Stop metrics report if metrics monitor is disabled.
try {
StormMonitor monitor = zkCluster.get_storm_monitor(topologyId);
if (null != monitor) {
boolean newMetricsMonitor = monitor.getMetrics();
MetricReporter metricReporter = workerData.getMetricsReporter();
boolean oldMetricsMonitor = metricReporter.isEnable();
if (oldMetricsMonitor != newMetricsMonitor) {
metricReporter.setEnable(newMetricsMonitor);
if (true == newMetricsMonitor) {
LOG.info("Start metrics reporter");
} else {
LOG.info("Stop metrics reporter");
}
}
}
} catch (Exception e) {
LOG.warn("Failed to get monitor status of topology " + topologyId);
LOG.debug(e);
}
// Process the topology status change
StatusType oldTopologyStatus = workerData.getTopologyStatus();
if (newTopologyStatus.equals(oldTopologyStatus)) {
return;
}