Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 1259554 - Changing the Storage Node JMX port does not update the JMX
Browse files Browse the repository at this point in the history
connection URL

Fix upgrade facet impl. of StorageNodeDiscoveryComponent. We're now able to
detect JMX port change at agent/pc startup time
  • Loading branch information
Libor Zoubek authored and spinder committed Sep 18, 2015
1 parent 9e8659d commit 6e65b3e
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -37,6 +37,7 @@
import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
import org.rhq.core.pluginapi.upgrade.ResourceUpgradeContext;
import org.rhq.plugins.cassandra.CassandraNodeDiscoveryComponent;
import org.rhq.plugins.jmx.JMXDiscoveryComponent;

/**
* @author Stefan Negrea
Expand Down Expand Up @@ -129,6 +130,23 @@ public ResourceUpgradeReport upgrade(ResourceUpgradeContext ruc) {
upgrade = true;
}

String newPort = newPluginConfig.getSimpleValue(JMX_PORT_PROPERTY);
String oldPort = oldPluginConfig.getSimpleValue(JMX_PORT_PROPERTY);
if (null != newPort && !newPort.equals(oldPort)) {
oldPluginConfig.put(new PropertySimple(JMX_PORT_PROPERTY, newPort));
upgrade = true;
}

String newJmxUrl = newPluginConfig
.getSimpleValue(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY);
String oldJmxurl = oldPluginConfig
.getSimpleValue(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY);
if (null != newJmxUrl && !newJmxUrl.equals(oldJmxurl)) {
oldPluginConfig.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY,
newJmxUrl));
upgrade = true;
}

if (upgrade) {
result = new ResourceUpgradeReport();
result.setNewPluginConfiguration(oldPluginConfig);
Expand Down

0 comments on commit 6e65b3e

Please sign in to comment.