String hostName, String serverName, Server[] servers, PortInUseException exception)
throws ConfigException, InstanceException
{
PropertyConfigBean pcb = getPropertyConfigBean();
PortInUseException result = exception;
//Iterate through all the properties of the newly created server and check for conflicts
//with all other servers on the same node agent.
for (Enumeration e = serverProps.propertyNames() ; e.hasMoreElements() ;) {
String name = (String)e.nextElement();
if (name.toLowerCase().indexOf(PORT_SUFFIX) >= 0) {
String value = (String)serverProps.getProperty(name);
try {
int port = Integer.parseInt(value);
//If we have already detected a conflict (while checking for DAS port conflicts,
//then there is no need to check the port for conflicts again.
if (result == null || !result.portAlreadyConflicts(port)) {
//If the name of the property contains the string "port" and
//the value of the property is numeric then check for a
//port conflict against the other servers on the same
//machine (i.e. with the same node agent).
String nextServerName = null;
for (int i = 0; i < servers.length; i++) {
nextServerName = servers[i].getName();
//We do not want to check against port conflicts with ourself.
if (!nextServerName.equals(serverName)) {
Properties props = pcb.getTargetedProperties(
nextServerName, true);
try {
checkForPortPropertyConflicts(name, port,
props, nextServerName, hostName);
} catch (PortInUseException ex) {
//Add on any newly found conflict to the exception
if (result == null) {
result = ex;
} else {
result.augmentException(ex);
}
}
}
}
}