Package com.sun.enterprise.ee.admin

Examples of com.sun.enterprise.ee.admin.PortInUse


     */
    private ArrayList pickNonConflictingPorts(Server server, ArrayList portsInUse)
        throws ConfigException
    {       
        Properties props = new Properties();
        PortInUse portInUse;
        int port;
       
        //We only want to check for port conflicts if the node agent specified has rendezvous'd;
        //otherwise, the host name on which it is residing is unknown (defaulting to "localhost").
        //Before we can indicate whether a port is in use, we must know the valid host name.
        final boolean isBoundToHost = getPortConflictCheckerConfigBean().isBoundToHost(server);
       
        //Iterate through all the conflicting ports and pick new values.
        for (int i = 0; i < portsInUse.size(); i++) {
            portInUse = (PortInUse)portsInUse.get(i);
            port = portInUse.getPort();
            int newPort = 0;
            if (isBoundToHost) {
                newPort = NetUtils.getNextFreePort(portInUse.getHostName(), port);           
            } else {
                newPort = port + 1;
            }
            //Keep track of the newly assigned and non-conflicting port. WARNING: we are
            //side affecting the incoming ArrayList.
            portInUse.setNewPort(newPort);
            //Build the list of system properties to add to the server instance
            props.put(portInUse.getPropertyName(), new Integer(newPort).toString());
        }
        addServerProperties(server, props);
        return portsInUse;
    }
View Full Code Here


                        portsInUse = newPorts;
                    } else {
                        //Now take all the newly resolved ports and apply them to the original list, updating
                        //only the new port.
                        for (int j = 0; j < newPorts.size(); j++) {
                            PortInUse newPort = (PortInUse)newPorts.get(j);                       
                            for (int k = 0; k < portsInUse.size(); k++) {
                                PortInUse port = (PortInUse)portsInUse.get(k);
                                if (port.getPropertyName().equals(newPort.getPropertyName())) {
                                    port.setNewPort(newPort.getNewPort());
                                    break;
                                }
                            }
                        }
                    }
View Full Code Here

        for (Enumeration e = newServerProps.propertyNames() ; e.hasMoreElements() ;) {           
            String name = (String)e.nextElement();
            if (name.toLowerCase().indexOf(PORT_SUFFIX) >= 0) {
                String value = (String)newServerProps.getProperty(name);
                if (!NetUtils.isPortStringValid(value)) {
                    invalidPorts.add(new PortInUse(name));
                }
            }
        }
        if (invalidPorts.size() > 0) {
            throw new InvalidPortException(invalidPorts);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.ee.admin.PortInUse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.