use of org.objectweb.proactive.extensions.dataspaces.exceptions.NotConfiguredException in project scheduling by ow2-proactive.
the class RMNodeConfigurator method configureNode.
/**
* Configures the node.
* Every different configuration steps must be handled in this method.
* @param rmnodeToAdd the rmnode to be configured
*/
public void configureNode(RMNode rmnodeToAdd) {
String nodeURL = rmnodeToAdd.getNodeURL();
try {
Node nodeToAdd = rmnodeToAdd.getNode();
String dataSpaceStatus = nodeToAdd.getProperty(RMNodeStarter.DATASPACES_STATUS_PROP_NAME);
if (dataSpaceStatus == null) {
// no data space configured on the node
logger.debug("Configuring data spaces for node " + nodeToAdd.getNodeInformation().getURL());
if (!configureForDataSpace(nodeToAdd)) {
// the dataspaces could not be configured, the node should be killed.
nodeToAdd.getProActiveRuntime().killRT(true);
throw new NotConfiguredException("Failed to configure dataspaces, check the node logs for more details");
}
} else if (!dataSpaceStatus.equals(Boolean.TRUE.toString())) {
// there was a problem of data space configuring
nodeToAdd.getProActiveRuntime().killRT(true);
throw new NotConfiguredException("Cannot configure data spaces : " + dataSpaceStatus);
} else {
// data space is configured
logger.debug("Data spaces is already configured for node " + nodeToAdd.getNodeInformation().getURL());
}
// get the node tags specified in the node property NODE_TAGS_PROP_NAME (separated by comma)
String tagsString = nodeToAdd.getProperty(RMNodeStarter.NODE_TAGS_PROP_NAME);
if (tagsString != null && !tagsString.isEmpty()) {
Set<String> tags = Arrays.stream(tagsString.split(",")).map(String::trim).filter(s -> !s.isEmpty()).collect(Collectors.toSet());
rmnodeToAdd.setNodeTags(tags);
}
// setting node JMX connector urls
rmnodeToAdd.setJMXUrl(JMXTransportProtocol.RMI, nodeToAdd.getProperty(RMNodeStarter.JMX_URL + JMXTransportProtocol.RMI));
rmnodeToAdd.setJMXUrl(JMXTransportProtocol.RO, nodeToAdd.getProperty(RMNodeStarter.JMX_URL + JMXTransportProtocol.RO));
// blocking call involving running ping process on the node
if (PAResourceManagerProperties.RM_TOPOLOGY_ENABLED.getValueAsBoolean()) {
RMCore.topologyManager.addNode(nodeToAdd);
}
rmcore.internalAddNodeToCore(rmnodeToAdd);
} catch (Exception e) {
logger.error("Cannot properly configure the node " + nodeURL + " because of an error during configuration phase", e);
// if a problem occurs during the configuration step,
// the node is set to down
rmcore.setDownNode(nodeURL);
}
}
Aggregations