if (getSecurityGroups() != null) sb.append("SecurityGroups: ").append(getSecurityGroups()).append(","); if (getSubnetId() != null) sb.append("SubnetId: ").append(getSubnetId()).append(","); if (getUserData() != null) sb.append("UserData: ").append(getUserData()).append(",");
hashCode = prime * hashCode + ((getSecurityGroupIds() == null) ? 0 : getSecurityGroupIds().hashCode()); hashCode = prime * hashCode + ((getSecurityGroups() == null) ? 0 : getSecurityGroups().hashCode()); hashCode = prime * hashCode + ((getSubnetId() == null) ? 0 : getSubnetId().hashCode()); hashCode = prime * hashCode + ((getUserData() == null) ? 0 : getUserData().hashCode()); hashCode = prime * hashCode + ((getAdditionalInfo() == null) ? 0 : getAdditionalInfo().hashCode());
if (other.getSecurityGroups() != null && other.getSecurityGroups().equals(this.getSecurityGroups()) == false) return false; if (other.getSubnetId() == null ^ this.getSubnetId() == null) return false; if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == false) return false; if (other.getUserData() == null ^ this.getUserData() == null)
if (getBlockDeviceMappings() != null) sb.append("BlockDeviceMappings: " + getBlockDeviceMappings() + ","); if (isMonitoring() != null) sb.append("Monitoring: " + isMonitoring() + ","); if (getSubnetId() != null) sb.append("SubnetId: " + getSubnetId() + ","); if (isDisableApiTermination() != null) sb.append("DisableApiTermination: " + isDisableApiTermination() + ","); if (getInstanceInitiatedShutdownBehavior() != null) sb.append("InstanceInitiatedShutdownBehavior: " + getInstanceInitiatedShutdownBehavior() + ",");
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getImageId() == null) ? 0 : getImageId().hashCode()); hashCode = prime * hashCode + ((getMinCount() == null) ? 0 : getMinCount().hashCode()); hashCode = prime * hashCode + ((getMaxCount() == null) ? 0 : getMaxCount().hashCode()); hashCode = prime * hashCode + ((getKeyName() == null) ? 0 : getKeyName().hashCode()); hashCode = prime * hashCode + ((getSecurityGroups() == null) ? 0 : getSecurityGroups().hashCode()); hashCode = prime * hashCode + ((getSecurityGroupIds() == null) ? 0 : getSecurityGroupIds().hashCode()); hashCode = prime * hashCode + ((getUserData() == null) ? 0 : getUserData().hashCode()); hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode()); hashCode = prime * hashCode + ((getPlacement() == null) ? 0 : getPlacement().hashCode()); hashCode = prime * hashCode + ((getKernelId() == null) ? 0 : getKernelId().hashCode()); hashCode = prime * hashCode + ((getRamdiskId() == null) ? 0 : getRamdiskId().hashCode()); hashCode = prime * hashCode + ((getBlockDeviceMappings() == null) ? 0 : getBlockDeviceMappings().hashCode()); hashCode = prime * hashCode + ((isMonitoring() == null) ? 0 : isMonitoring().hashCode()); hashCode = prime * hashCode + ((getSubnetId() == null) ? 0 : getSubnetId().hashCode()); hashCode = prime * hashCode + ((isDisableApiTermination() == null) ? 0 : isDisableApiTermination().hashCode()); hashCode = prime * hashCode + ((getInstanceInitiatedShutdownBehavior() == null) ? 0 : getInstanceInitiatedShutdownBehavior().hashCode()); hashCode = prime * hashCode + ((getPrivateIpAddress() == null) ? 0 : getPrivateIpAddress().hashCode()); hashCode = prime * hashCode + ((getClientToken() == null) ? 0 : getClientToken().hashCode()); hashCode = prime * hashCode + ((getAdditionalInfo() == null) ? 0 : getAdditionalInfo().hashCode()); hashCode = prime * hashCode + ((getNetworkInterfaces() == null) ? 0 : getNetworkInterfaces().hashCode()); hashCode = prime * hashCode + ((getIamInstanceProfile() == null) ? 0 : getIamInstanceProfile().hashCode()); hashCode = prime * hashCode + ((isEbsOptimized() == null) ? 0 : isEbsOptimized().hashCode()); return hashCode; }
if (other.isMonitoring() == null ^ this.isMonitoring() == null) return false; if (other.isMonitoring() != null && other.isMonitoring().equals(this.isMonitoring()) == false) return false; if (other.getSubnetId() == null ^ this.getSubnetId() == null) return false; if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == false) return false; if (other.isDisableApiTermination() == null ^ this.isDisableApiTermination() == null) return false; if (other.isDisableApiTermination() != null && other.isDisableApiTermination().equals(this.isDisableApiTermination()) == false) return false;
if (runInstancesRequest.getSubnetId() != null) { request.addParameter("SubnetId", StringUtils.fromString(runInstancesRequest.getSubnetId()));
log.error(String.format("Insufficient capacity in subnet [%s]: %s", request.getSubnetId(), e)); requestNumber = requestNumber + 1;
private Map<String, Instance> launchEC2Instances(final String instanceType, final RunInstancesRequestBuilder runInstancesRequestBuilder, final boolean createIfNonExistent) { final Map<String, Instance> instances = this.findExistingInstances(instanceType); // If instances is empty, that means we did not find any to reuse so let's create them if (instances.isEmpty() && createIfNonExistent) { final RunInstancesRequest request = runInstancesRequestBuilder.build(); System.out.println(String.format( "Did not find any existing instances, starting new ones with security group: '%s' and subnet: '%s'", request.getSecurityGroups().get(0), request.getSubnetId() == null ? "" : request.getSubnetId())); final RunInstancesResult runInstancesResult = this.ec2client.runInstances(request); for (final Instance instance : runInstancesResult.getReservation().getInstances()) { System.out.println(instance.getInstanceId() + " launched"); instances.put(instance.getInstanceId(), instance); } // Tag instances on creation. Adding the tag enables us to ensure we are terminating a load generator instance. this.ec2client.createTags(new CreateTagsRequest() .withResources(instances.keySet()) .withTags(this.instanceTag)); final DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest().withInstanceIds(instances.keySet()); this.startAllInstances(instances, describeInstancesRequest); } return instances; }
if (getSecurityGroups() != null) sb.append("SecurityGroups: ").append(getSecurityGroups()).append(","); if (getSubnetId() != null) sb.append("SubnetId: ").append(getSubnetId()).append(","); if (getUserData() != null) sb.append("UserData: ").append(getUserData()).append(",");
"\tamiId:" + runInstancesRequest.getImageId() +"\n"+ "\tsecGrpId:" + runInstancesRequest.getSecurityGroupIds().get(0) +"\n"+ "\tsubnetId:" + runInstancesRequest.getSubnetId() +"\n"+ "\tinstanceType:" + runInstancesRequest.getInstanceType() +"\n"+ "\tshutdownBehavior:" + runInstancesRequest.getInstanceInitiatedShutdownBehavior() +"\n"+
hashCode = prime * hashCode + ((getSecurityGroupIds() == null) ? 0 : getSecurityGroupIds().hashCode()); hashCode = prime * hashCode + ((getSecurityGroups() == null) ? 0 : getSecurityGroups().hashCode()); hashCode = prime * hashCode + ((getSubnetId() == null) ? 0 : getSubnetId().hashCode()); hashCode = prime * hashCode + ((getUserData() == null) ? 0 : getUserData().hashCode()); hashCode = prime * hashCode + ((getAdditionalInfo() == null) ? 0 : getAdditionalInfo().hashCode());
request.addParameter("Monitoring.Enabled", StringUtils.fromBoolean(runInstancesRequest.isMonitoring())); if (runInstancesRequest.getSubnetId() != null) { request.addParameter("SubnetId", StringUtils.fromString(runInstancesRequest.getSubnetId()));
if (other.getSecurityGroups() != null && other.getSecurityGroups().equals(this.getSecurityGroups()) == false) return false; if (other.getSubnetId() == null ^ this.getSubnetId() == null) return false; if (other.getSubnetId() != null && other.getSubnetId().equals(this.getSubnetId()) == false) return false; if (other.getUserData() == null ^ this.getUserData() == null)
if (runInstancesRequest.getSubnetId() != null) { request.addParameter("SubnetId", StringUtils.fromString(runInstancesRequest.getSubnetId()));