I think making the EC2Slave.stop() method public would be fine, it should be 
safe enough to call from outside the object itself. At least it's not any less 
safe than most of the existing code in the plugin, which has a large number of 
concurrency issues already :-)

----- Original Message -----
From: jenkinsci-users@googlegroups.com
To: jenkinsci-users@googlegroups.com
Cc: Kevin Fleming (BLOOMBERG/ 731 LEXIN)
At: Jan 21 2014 15:00:01

What do you think about exposing the stop() method? I found it in the source on 
GitHub, but I've only just begun to take a look at the source code for this 
project.

void stop() {
        try {
            AmazonEC2 ec2 = getCloud().connect();
            StopInstancesRequest request = new StopInstancesRequest(
                    Collections.singletonList(getInstanceId()));
            ec2.stopInstances(request);
            LOGGER.info("EC2 instance stopped: " + getInstanceId());
            toComputer().disconnect(null);
        } catch (AmazonClientException e) {
            Instance i = getInstance(getInstanceId(), getCloud());
            LOGGER.log(Level.WARNING, "Failed to terminate EC2 instance: 
"+getInstanceId() + " info: "+((i != null)?i:"") , e);
        }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to