public static boolean computeInstancesStartedStateWithAcceptedErrorRate(AmazonEC2AsyncClient client,VerificationHost host,List<String> instanceIds,int errorRate) throws Throwable {
  if (instanceIds.size() == 0) {
    return false;
  }
  ArrayList<Boolean> provisioningFlags=new ArrayList<Boolean>(instanceIds.size());
  for (int i=0; i < instanceIds.size(); i++) {
    provisioningFlags.add(i,Boolean.FALSE);
  }
  checkInstancesStarted(host,client,instanceIds,provisioningFlags);
  int totalCount=instanceIds.size();
  int passCount=(int)Math.ceil((((100 - errorRate) / HUNDERED) * totalCount));
  int poweredOnCount=0;
  for (  boolean startedFlag : provisioningFlags) {
    if (startedFlag) {
      poweredOnCount++;
    }
  }
  return (poweredOnCount >= passCount);
}

public static boolean computeInstancesStartedStateWithAcceptedErrorRate ( AmazonEC2AsyncClient client , VerificationHost host , List < String > instanceIds , int errorRate ) throws Throwable { if ( instanceIds . size ( ) == 0 ) { return false ; } ArrayList < Boolean > provisioningFlags = new ArrayList < Boolean > ( instanceIds . size ( ) ) ; for ( int i = 0 ; i < instanceIds . size ( ) ; i ++ ) { provisioningFlags . add ( i , Boolean . FALSE ) ; } checkInstancesStarted ( host , client , instanceIds , provisioningFlags ) ; int totalCount = instanceIds . size ( ) ; int passCount = ( int ) Math . ceil ( ( ( ( 100 - errorRate ) / HUNDERED ) * totalCount ) ) ; int poweredOnCount = 0 ; for ( boolean startedFlag : provisioningFlags ) { if ( startedFlag ) { poweredOnCount ++ ; } } return ( poweredOnCount >= passCount ) ; }
method that polls to see if the instances provisioned have turned on . this method accepts an error count to allow some room for errors in case all the requested resources are not provisioned correctly .
