public PortManager(Cluster cluster, Config config, Domain theDomain,
Server theNewServer) throws TransactionFailure {
try {
if (theNewServer == null || theDomain == null)
throw new TransactionFailure(Strings.get("internal.error", "null argument in PortManager constructor"));
newServer = theNewServer;
domain = theDomain;
serverName = newServer.getName();
// bnevins 7-23-2010
// we are probably being called from inside the create decorator for a server.
// the server is not yet committed. We can't call ducktype methods
// on the server yet. So we do this self-serve call to get the host
//host = newServer.getHost();
host = new ServerHelper(theNewServer, config).getAdminHost();
allPorts = new TreeSet<Integer>();
newServerPorts = new ServerPorts(cluster, config, domain, newServer);
isLocal = NetUtils.isThisHostLocal(host);
allServers = domain.getServers().getServer();
// why all this nonsense? ConcurrentModificationException!!!
for (Iterator<Server> it = allServers.iterator(); it.hasNext();) {
Server curr = it.next();
if (serverName.equals(curr.getName())) {
it.remove();
}
}
serversOnHost = new ArrayList<ServerPorts>();
}
catch (TransactionFailure tf) {
throw tf;
}
catch (Exception e) {
// this Exception will not take just a Throwable. I MUST give a string
throw new TransactionFailure(e.toString(), e);
}
}