if (nodeId == null) return;
if (nodeId.indexOf("/") == -1) nodeId = "/node/"+nodeId; // add CLUSTER_MARKER_TAG to e.g. "/node/avalon.mycomp.com"
String oldClusterObjectName = ""; // e.g. "org.xmlBlaster:nodeClass=node,node=clientSUB1"
String oldServerNodeInstanceName = ""; // e.g. "clientSUB1"
ContextNode clusterContext = null;
if (this.contextNode != null) {
// same instance as glob.getContextNode():
clusterContext = this.contextNode.getParent(ContextNode.CLUSTER_MARKER_TAG);
oldServerNodeInstanceName = clusterContext.getInstanceName();
oldClusterObjectName = clusterContext.getAbsoluteName(ContextNode.SCHEMA_JMX);
}
// Verify the publicSessionId ...
try {
if (this.mbeanHandle != null && this.jmxPublicSessionId != getPublicSessionId()) {
/*int count = */this.glob.getJmxWrapper().renameMBean(this.mbeanHandle.getObjectInstance().getObjectName().toString(),
ContextNode.SESSION_MARKER_TAG, ""+getPublicSessionId());
this.mbeanHandle.getContextNode().setInstanceName(""+getPublicSessionId());
this.jmxPublicSessionId = getPublicSessionId();
}
if (this.mbeanHandle == null &&
this.contextNode != null &&
!this.contextNode.getInstanceName().equals(""+getPublicSessionId())) {
this.contextNode.setInstanceName(""+getPublicSessionId());
}
}
catch (XmlBlasterException e) {
log.warning(getLogId()+"Ignoring problem during JMX session registration: " + e.toString());
}
// parse new cluster node name ...
ContextNode tmp = ContextNode.valueOf(nodeId);
ContextNode tmpClusterContext = (tmp==null)?null:tmp.getParent(ContextNode.CLUSTER_MARKER_TAG);
if (tmpClusterContext == null) {
log.severe(getLogId()+"Ignoring unknown serverNodeId '" + nodeId + "'");
return;
}
String newServerNodeInstanceName = tmpClusterContext.getInstanceName(); // e.g. "heron"
if (oldServerNodeInstanceName.equals(newServerNodeInstanceName)) {
return; // nothing to do, same cluster name
}
this.glob.getContextNode().setInstanceName(newServerNodeInstanceName);
if (clusterContext == null) {
clusterContext = this.glob.getContextNode();
String ln = getLoginName();
if (ln != null && ln.length() > 0) {
String instanceName = this.glob.validateJmxValue(ln);
ContextNode contextNodeSubject = new ContextNode(ContextNode.CONNECTION_MARKER_TAG, instanceName, clusterContext);
this.contextNode = new ContextNode(ContextNode.SESSION_MARKER_TAG, ""+getPublicSessionId(), contextNodeSubject);
}
}
else {
clusterContext.setInstanceName(newServerNodeInstanceName);
}