Package org.rhq.common.jbossas.client.controller

Examples of org.rhq.common.jbossas.client.controller.SocketBindingJBossASClient


    }

    public static void setSocketBindings(ModelControllerClient mcc, HashMap<String, String> serverProperties)
        throws Exception {

        final SocketBindingJBossASClient client = new SocketBindingJBossASClient(mcc);
        for (SocketBindingInfo binding : defaultSocketBindings) {
            // use the port defined by the server's properties if set, otherwise, just use our hardcoded default
            int newPort = binding.port;
            String overrideValue = serverProperties.get(binding.sysprop);
            if (overrideValue != null) {
                try {
                    newPort = Integer.parseInt(overrideValue);
                } catch (Exception e) {
                    LOG.warn("Invalid port in system property [" + binding.sysprop + "]: " + overrideValue);
                }
            }
            LOG.info(String.format("Setting socket binding [%s] to [${%s:%d}]", binding.name, binding.sysprop, newPort));
            try {
                client.setStandardSocketBindingPortExpression(binding.name, binding.sysprop, newPort);
            } catch (Exception e) {
                // If the binding is required, we re-throw a possible exception. Otherwise just log
                if (binding.required) {
                    throw e;
                } else {
                    LOG.info(String.format("Setting socket binding port for [%s] resulted in [%s] - this is harmless ",
                        binding.name, e.getMessage())); // TODO log at debug level only?
                }
            }

            // if we need to switch the binding's interface, do it now
            if (binding.interfaceName != null) {
                LOG.info(String.format("Setting socket binding [%s] to use interface [%s]", binding.name,
                    binding.interfaceName));
                try {
                    client.setStandardSocketBindingInterface(binding.name, binding.interfaceName);
                } catch (Exception e) {
                    // If the binding is required, we re-throw a possible exception. Otherwise just log
                    if (binding.required) {
                        throw e;
                    } else {
View Full Code Here

TOP

Related Classes of org.rhq.common.jbossas.client.controller.SocketBindingJBossASClient

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.