Examples of LaunchConfiguration


Examples of com.amazonaws.services.autoscaling.model.LaunchConfiguration

    }

    private void verifyLaunchConfigList(List<Resource> resources, List<LaunchConfiguration> lcList) {
        Assert.assertEquals(resources.size(), lcList.size());
        for (int i = 0; i < resources.size(); i++) {
            LaunchConfiguration lc = lcList.get(i);
            if (i % 2 == 0) {
                verifyLaunchConfig(resources.get(i), lc.getLaunchConfigurationName(), true);
            } else {
                verifyLaunchConfig(resources.get(i), lc.getLaunchConfigurationName(), null);
            }
        }
    }
View Full Code Here

Examples of com.amazonaws.services.autoscaling.model.LaunchConfiguration

        }
        return lcList;
    }

    private LaunchConfiguration mkLaunchConfig(String lcName) {
        return new LaunchConfiguration().withLaunchConfigurationName(lcName);
    }
View Full Code Here

Examples of com.amazonaws.services.autoscaling.model.LaunchConfiguration

            }
            asgResource.setAdditionalField(ASG_FIELD_INSTANCES, StringUtils.join(instances, ","));
            asgResource.setAdditionalField(ASG_FIELD_ELBS,
                    StringUtils.join(asg.getLoadBalancerNames(), ","));
            String lcName = asg.getLaunchConfigurationName();
            LaunchConfiguration lc = nameToLaunchConfig.get(lcName);
            if (lc != null) {
                asgResource.setAdditionalField(ASG_FIELD_LC_NAME, lcName);
            }
            if (lc != null && lc.getCreatedTime() != null) {
                asgResource.setAdditionalField(ASG_FIELD_LC_CREATION_TIME,
                        String.valueOf(lc.getCreatedTime().getTime()));
            }
            // sets the field for the time when the ASG's traffic is suspended from ELB
            for (SuspendedProcess sp : asg.getSuspendedProcesses()) {
                if ("AddToLoadBalancer".equals(sp.getProcessName())) {
                    String suspensionTime = getSuspensionTimeString(sp.getSuspensionReason());
View Full Code Here

Examples of com.xerox.amazonws.ec2.LaunchConfiguration

    public List<HostNamePair> createInstances(String ami,
                                              String keypairId,
                                              Ec2Connection.Ec2InstanceType instanceType,
                                              int instanceCount,
                                              List<String> securityGroups) throws Exception {
        LaunchConfiguration launchConfiguration = new LaunchConfiguration(ami);
        launchConfiguration.setInstanceType(InstanceType.valueOf(instanceType.name()));
        launchConfiguration.setKeyName(keypairId);
        launchConfiguration.setMinCount(instanceCount);
        launchConfiguration.setMaxCount(instanceCount);
        if (securityGroups != null && securityGroups.size() > 0) {
            launchConfiguration.setSecurityGroup(securityGroups);
        }

        ReservationDescription reservationDescription = ec2.runInstances(launchConfiguration);

        List<String> instanceIds = new ArrayList<String>();
View Full Code Here

Examples of org.apache.ace.processlauncher.LaunchConfiguration

     * @param pid the PID of the process that was launched, cannot be <code>null</code>;
     * @param launcher the terminated process to handle, cannot be <code>null</code>.
     * @throws IOException in case of I/O problems during the respawn of a terminated process.
     */
    private boolean processNeedsToBeRespawned(String pid, ProcessLauncher launcher) throws IOException {
        LaunchConfiguration config = launcher.getLaunchConfiguration();
        Integer exitValue = launcher.getExitValue();

        // Is the process non-successfully terminated?
        if (isNonSuccessfullyTerminated(config, exitValue)) {
            // If so, does it need to be respawned?
            if (config.isRespawnAutomatically()) {
                // We need to respawn the process automatically!
                String logLine =
                    String.format("Process %s (%s) terminated with value %d;" + " respawning it as requested...", pid,
                        config.getExecutableName(), exitValue);
                m_logger.log(LogService.LOG_INFO, logLine);

                // Simply relaunch the process again...
                return true;
            }
            else {
                // Don't bother restarting the process...
                String logLine =
                    String.format("Process %s (%s) terminated with value %d.", pid, config.getExecutableName(),
                        exitValue);
                m_logger.log(LogService.LOG_INFO, logLine);
            }
        }
        else {
            // Process ended normally...
            String logLine = String.format("Process %s (%s) terminated normally.", pid, config.getExecutableName());
            m_logger.log(LogService.LOG_INFO, logLine);
        }

        return false;
    }
View Full Code Here

Examples of org.apache.ace.processlauncher.LaunchConfiguration

     *
     * @param pid the service PID that is to be deleted, never <code>null</code>.
     * @see org.osgi.service.cm.ManagedServiceFactory#deleted(java.lang.String)
     */
    public final void deleted(final String pid) {
        LaunchConfiguration oldLaunchConfig = null;

        synchronized (m_launchConfigurations) {
            oldLaunchConfig = m_launchConfigurations.remove(pid);
        }

View Full Code Here

Examples of org.apache.ace.processlauncher.LaunchConfiguration

     * @see org.osgi.service.cm.ManagedServiceFactory#updated(java.lang.String,
     *      java.util.Dictionary)
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public final void updated(final String pid, final Dictionary config) throws ConfigurationException {
        LaunchConfiguration oldLaunchConfig = null;
        LaunchConfiguration newLaunchConfig = null;

        if (config != null) {
            newLaunchConfig = createLaunchConfiguration(config);
        }

View Full Code Here

Examples of org.apache.ace.processlauncher.LaunchConfiguration

        // This test will not work on Windows!
        if (getOSName().contains("windows")) {
            return;
        }

        LaunchConfiguration launchConfig = createLaunchConfiguration("/bin/sh", "-c", "sleep 1 && exit 1");

        int processCountBefore = m_processManager.getRunningProcessesCount();

        m_processManager.launch("myPid", launchConfig);
View Full Code Here

Examples of org.apache.ace.processlauncher.LaunchConfiguration

        // This test will only work on Windows!
        if (!getOSName().contains("windows")) {
            return;
        }

        LaunchConfiguration launchConfig = createLaunchConfiguration("PING", "-n", "2", "127.0.0.1");

        int processCountBefore = m_processManager.getRunningProcessesCount();

        m_processManager.launch("myPid", launchConfig);
View Full Code Here

Examples of org.apache.ace.processlauncher.LaunchConfiguration

        // functionality works, as this currently checks for certain exit
        // values...
        String script =
            String.format("L=$(cat %1$s | wc -l)" + "&& echo $L >> %1$s && exit $((%2$d-$L))", tmpFilename, count);

        LaunchConfiguration launchConfig =
            createLaunchConfiguration(true /* respawnAutomatically */, "/bin/bash", "-c", script);

        int processCountBefore = m_processManager.getRunningProcessesCount();

        m_processManager.launch("myPid", launchConfig);
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.