Examples of MCTException


Examples of gov.nasa.arc.mct.util.exception.MCTException

     */
    public ShiftChangeReporter(String initialUser) throws MCTException, IOException {
        final MCTProperties mctProperties = MCTProperties.DEFAULT_MCT_PROPERTIES;

        if (StringUtil.isEmpty(initialUser))
            throw new MCTException("empty or null initial user");
        currentUser = initialUser;

        String portProp = mctProperties.getProperty("mcc.monitor.port");
        if (StringUtil.isEmpty(portProp)) {
            throw new MCTException("property mcc.monitor.port is not set or empty.");
        }
        try {
            this.monitorPort = new Integer(portProp);
        } catch (NumberFormatException e) {
            throw new MCTException(
                    "Could not convert mcc.monitor.port to a valid port. Check that mcc.monitor.port is set.", e);
        }

        reporterExpirationSeconds = DEFAULT_EXPIRATION;
        String expire = mctProperties.getProperty("mcc.reporter.expiration", "0");
        try {
            reporterExpirationSeconds = new Integer(expire);
        } catch (NumberFormatException e) {
            logger.warn("Could not convert mcc.reporter.expiration; using default");
        }

        interval = DEFAULT_INTERVAL;
        String intervalProp = mctProperties.getProperty("mcc.monitor.interval");
        if (!StringUtil.isEmpty(intervalProp)) {
            try {
                this.interval = new Integer(intervalProp);
            } catch (NumberFormatException e) {
                logger.warn("Could not convert mcc.monitor.interval; using default");
            }
        }

        execCommand = mctProperties.getProperty("mcc.monitor.command");
        if (StringUtil.isEmpty(execCommand)) {
            throw new MCTException("property mcc.monitor.command is not set or invalid.");
        }
    }
View Full Code Here

Examples of gov.nasa.arc.mct.util.exception.MCTException

                connectionStatus = ConnectionStatus.STATUS_CONNECTED;
                stopTrying = true;
            } catch (ConnectException e) {
                if (connectCounter >= 5) {
                    stopTrying = true;
                    throw new MCTException("Could not open socket to port (gave up):" + monitorPort, e);
                } else {
                    logger.debug("retry {0}", connectionStatus);
                    connectCounter++;
                    try {
                        Thread.sleep(10000);
                    } catch (InterruptedException e1) {
                    }
                }
            } catch (IOException e) {
                stopTrying = true;
                throw new MCTException("Exception trying to open socket to port:" + monitorPort, e);
            }
        }
        logger.info("connectionStatus: {0}", connectionStatus);
        return s;
    }
View Full Code Here

Examples of gov.nasa.arc.mct.util.exception.MCTException

            Process proc = null;
            try {
                proc = rt.exec(execCommand);
            } catch (IOException e1) {
                throw new MCTException("Could not execute command: " + execCommand);
            }

            // any error message?
            StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERR");

            // output from stdout
            StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUT", this);

            // kick them off
            errorGobbler.start();
            outputGobbler.start();

            // any error???
            int exitVal = 0;
            try {
                exitVal = proc.waitFor();
            } catch (InterruptedException e) {
                logger.warn("Exec command interrupted.");
            }
            if (exitVal == 0) {
                try {
                    Thread.sleep(interval * 1000);
                } catch (InterruptedException e) {
                    logger.warn("sleep interrupted");
                }
            } else {
                throw new MCTException("exitVal " + exitVal + " returned from command: " + execCommand);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.