use of com.sun.appserv.management.config.NodeAgentsConfig in project Payara by payara.
the class TestMain method getNodeAgentConnections.
public Map<String, AppserverConnectionSource> getNodeAgentConnections(final DomainRoot domainRoot, final PropertyGetter getter) {
final NodeAgentsConfig nacs = domainRoot.getDomainConfig().getNodeAgentsConfig();
if (nacs == null)
return null;
final Map<String, NodeAgentConfig> nodeAgentConfigs = nacs.getNodeAgentConfigMap();
final Map<String, AppserverConnectionSource> nodeAgentConnections = new HashMap<String, AppserverConnectionSource>();
println("");
println("Contacting node agents...");
for (final NodeAgentConfig nodeAgentConfig : nodeAgentConfigs.values()) {
final String nodeAgentName = nodeAgentConfig.getName();
final JMXConnectorConfig connConfig = nodeAgentConfig.getJMXConnectorConfig();
final AttributeResolverHelper r = new AttributeResolverHelper(connConfig);
if (!r.resolveBoolean("Enabled")) {
println(nodeAgentName + ": DISABLED CONNECTOR");
continue;
}
final String address = connConfig.getAddress();
final int port = r.resolveInt("Port");
final boolean tlsEnabled = r.resolveBoolean("SecurityEnabled");
final String protocol = connConfig.getProtocol();
if (!RMI_PROTOCOL_IN_CONFIG.equals(protocol)) {
println(nodeAgentName + ": UNSUPPORTED CONNECTOR PROTOCOL: " + protocol);
continue;
}
// See if we can connect
try {
final AppserverConnectionSource asConn = _getConnectionSource(getter, address, port);
final MBeanServerConnection conn = asConn.getMBeanServerConnection(false);
final boolean alive = conn.isRegistered(JMXUtil.getMBeanServerDelegateObjectName());
assert (alive);
nodeAgentConnections.put(nodeAgentName, asConn);
println(nodeAgentName + ": ALIVE");
} catch (Exception e) {
println("Node agent " + nodeAgentConfig.getName() + " could not be contacted: " + e.getClass().getName());
println(nodeAgentName + ": COULD NOT BE CONTACTED");
continue;
}
}
println("");
return nodeAgentConnections;
}
Aggregations