com.atlassian.aws.ec2
Class RemoteEC2InstanceImpl

java.lang.Object
  extended by com.atlassian.aws.ec2.RemoteEC2InstanceImpl
All Implemented Interfaces:
EC2Instance, RemoteEC2Instance

public class RemoteEC2InstanceImpl
extends Object
implements RemoteEC2Instance


Constructor Summary
RemoteEC2InstanceImpl(InstanceLaunchConfiguration instanceConfiguration, int pollPeriodInSeconds, int maxSuccessiveSupervisionFailures, EC2InstanceListener listener, AWSAccount awsAccount, ScheduledExecutorService scheduledExecutorService, List<Throwable> backgroundThrowables)
           
 
Method Summary
 void addTag(String key, String value)
          Asynchronously adds an AWS tag to the instance.
 void asyncTerminate()
          Terminate this EC2 instance, asynchronously.
 InstanceLaunchConfiguration getInstanceConfiguration()
           
 String getInstanceId()
           
 InstanceStatus getInstanceStatus()
           
 void handleAddressChange(InstanceReservationDescription instance)
           
 void handleStateChange(InstanceReservationDescription instance, AwsSupportConstants.InstanceStateName newState)
           
 boolean isBeingTerminated()
           
 void start()
          Start the instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteEC2InstanceImpl

public RemoteEC2InstanceImpl(InstanceLaunchConfiguration instanceConfiguration,
                             int pollPeriodInSeconds,
                             int maxSuccessiveSupervisionFailures,
                             EC2InstanceListener listener,
                             AWSAccount awsAccount,
                             ScheduledExecutorService scheduledExecutorService,
                             List<Throwable> backgroundThrowables)
Parameters:
image - The image to boot.
keyName - The name of the public key to be made available in the instance's metadata, or
securityGroupIds - A list of the IDs of the security groups of which the instance is to be a member, or null if it is only to be a member of the default security group.
userData - An object to be serialised and made available to the instance as user data.
instanceType - The type of the instance, or null if it is to be of the default type.
requestedAvailabilityZone - The name of the availability zone to use, or null to use an arbitrary zone.
pollPeriodInSeconds - The period of time (in seconds) to wait between requests for EC2 instance status updates.
maxSuccessiveSupervisionFailures - The number of successive attempts to obtain EC2 instance status updates that are allowed to fail before the instance is considered to have failed, and an attempt is made to terminate it.
startupTimeoutInSeconds - The period of time (in seconds) to wait for the instance to transition from the PENDING state to the EC2InstanceState.RUNNING state before considering it as having FAILED_TO_START.
listener - A listener to receive notifications of changes in the state of the instance.
scheduledExecutorService - The executor service to be used to execute background tasks.
backgroundThrowables - A List to receive unhandled Throwables from background
Method Detail

start

public void start()
Description copied from interface: RemoteEC2Instance
Start the instance

Specified by:
start in interface RemoteEC2Instance

asyncTerminate

public void asyncTerminate()
Description copied from interface: RemoteEC2Instance

Terminate this EC2 instance, asynchronously.

Specified by:
asyncTerminate in interface RemoteEC2Instance

isBeingTerminated

public boolean isBeingTerminated()
Specified by:
isBeingTerminated in interface RemoteEC2Instance
Returns:
true if the instance is being terminated

handleAddressChange

public void handleAddressChange(@NotNull
                                InstanceReservationDescription instance)

handleStateChange

public void handleStateChange(InstanceReservationDescription instance,
                              AwsSupportConstants.InstanceStateName newState)

getInstanceConfiguration

public InstanceLaunchConfiguration getInstanceConfiguration()
Specified by:
getInstanceConfiguration in interface RemoteEC2Instance

getInstanceStatus

public InstanceStatus getInstanceStatus()
Specified by:
getInstanceStatus in interface RemoteEC2Instance

getInstanceId

public String getInstanceId()
Specified by:
getInstanceId in interface EC2Instance
Specified by:
getInstanceId in interface RemoteEC2Instance
Returns:
The ID of this EC2 instance, or null if it is not yet available.

addTag

public void addTag(@NotNull
                   String key,
                   @NotNull
                   String value)
Description copied from interface: RemoteEC2Instance
Asynchronously adds an AWS tag to the instance.

Specified by:
addTag in interface RemoteEC2Instance


Copyright © 2015 Atlassian. All rights reserved.