List of usage examples for com.amazonaws.services.ec2.model RebootInstancesRequest withInstanceIds
public RebootInstancesRequest withInstanceIds(java.util.Collection<String> instanceIds)
The instance IDs.
From source file:hu.mta.sztaki.lpds.cloud.entice.imageoptimizer.iaashandler.amazontarget.EC2VirtualMachine.java
License:Apache License
@Override public void rebootInstance() throws VMManagementException { try {//from w ww . j a v a 2 s . co m Shrinker.myLogger.info("Instance " + getInstanceId() + " received a reboot request"); describeInstance(true); RebootInstancesRequest rebootInstancesRequest = new RebootInstancesRequest(); rebootInstancesRequest.withInstanceIds(getInstanceIds()); System.out.println("[T" + (Thread.currentThread().getId() % 100) + "] VM reboot: " + getInstanceId() + " " + this.ip + " (@" + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()) + ")"); this.amazonEC2Client.rebootInstances(rebootInstancesRequest); Shrinker.myLogger.info("Reboot request dispatched for instance " + getInstanceId()); } catch (AmazonServiceException x) { Shrinker.myLogger.info("rebootInstance error: " + x.getMessage()); System.out.println("[T" + (Thread.currentThread().getId() % 100) + "] reboot instance AmazonServiceExzeption: " + x.getMessage()); // don't print the word exception throw new VMManagementException("runInstance exception", x); } catch (AmazonClientException x) { Shrinker.myLogger.info("rebootInstance error: " + x.getMessage()); System.out.println("[T" + (Thread.currentThread().getId() % 100) + "] reboot instance AmazonClientExzeption: " + x.getMessage()); // don't print the word exception throw new VMManagementException("runInstance exception", x); } }