Package com.sun.enterprise.ee.admin

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


                try {
                    //If the name of the property contains the string "port" and
                    //the value of the property is numeric then check for a
                    //port conflict.
                    if (port == Integer.parseInt(propValue)) {
                        throw new PortInUseException(serverName, hostName, port,
                            propertyName, propName);                  
                    }
                } catch (NumberFormatException ex) {
                    continue;
                }               
View Full Code Here


    private PortInUseException checkForDuplicatePorts(Properties newServerProps,
        String hostName, String serverName, PortInUseException exception)
        throws ConfigException, InstanceException
    {       
        final ConfigContext configContext = getConfigContext();          
        PortInUseException result = exception;
        final Properties serverProps = getPropertyConfigBean().getTargetedProperties(
            serverName, true);
               
        //Iterate through all the properties of the newly created server and check to
        //see if any of the ports are in use.
        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);
                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 duplicate port
                        //(i.e. value).
                        for (Enumeration e2 = serverProps.propertyNames(); e2.hasMoreElements() ;) {
                            String name2 = (String)e2.nextElement();           
                            if (name2.toLowerCase().indexOf(PORT_SUFFIX) >= 0) {
                                String value2 = (String)serverProps.getProperty(name2);
                                if (!name2.equals(name) && value.equals(value2)) {
                                    PortInUseException ex2 = new PortInUseException(
                                        serverName, hostName, port, name, name2);
                                    if (result == null) {
                                        result = ex2;
                                    } else {
                                        result.augmentException(ex2);
View Full Code Here

    private PortInUseException checkForPortInUseConflicts(Properties serverProps,
        String hostName, String serverName, PortInUseException exception)
        throws ConfigException, InstanceException
    {       
        final ConfigContext configContext = getConfigContext();          
        PortInUseException result = exception;
                       
        //Iterate through all the properties of the newly created server and check to
        //see if any of the ports are in use.
        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
                    //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.                        
                        if (!NetUtils.isPortFree(hostName, port)) {    
                            //System.out.println("yes");
                            PortInUseException ex2 = new PortInUseException(
                                serverName, hostName, port, name, null);
                            if (result == null) {
                                result = ex2;
                            } else {
                                result.augmentException(ex2);
View Full Code Here

        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);
                                    }
                                }
                            }
                        }
                    }
View Full Code Here

        final MBeanServerConnectionInfo serverInfo = InstanceRegistry.getInstanceConnectionInfo(
            configContext, serverName);
        final String hostName = serverInfo.getHost();
        final boolean isBoundToHost = isBoundToHost(server);
       
        PortInUseException exception = null;               
       
        //check for invalid ports (i.e. non-numeric ports or ports that are outside the valid range).
        checkForInvalidPorts(existingServerProps);
       
        //Check for duplicate ports within the server instance itself       
View Full Code Here

TOP

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

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.