@Nonnull @Override public NodeProvisioner.StrategyDecision apply(@Nonnull NodeProvisioner.StrategyState strategyState){
  LOG.debug("Applying provisioning.");
  final Label label=strategyState.getLabel();
  LoadStatisticsSnapshot snapshot=strategyState.getSnapshot();
  for (  DockerCloud dockerCloud : getDockerClouds()) {
    for (    DockerSlaveTemplate template : dockerCloud.getTemplates(label)) {
      if (notAllowedStrategy(template)) {
        continue;
      }
      int availableCapacity=snapshot.getAvailableExecutors() + snapshot.getConnectingExecutors() + strategyState.getAdditionalPlannedCapacity();
      int currentDemand=snapshot.getQueueLength();
      LOG.debug("Available capacity={}, currentDemand={}",availableCapacity,currentDemand);
      if (availableCapacity < currentDemand) {
        Collection<PlannedNode> plannedNodes=dockerCloud.provision(label,currentDemand - availableCapacity);
        LOG.debug("Planned {} new nodes",plannedNodes.size());
        strategyState.recordPendingLaunches(plannedNodes);
        availableCapacity+=plannedNodes.size();
        LOG.debug("After '{}' provisioning, available capacity={}, currentDemand={}",dockerCloud,availableCapacity,currentDemand);
      }
      if (availableCapacity >= currentDemand) {
        LOG.debug("Provisioning completed");
        return NodeProvisioner.StrategyDecision.PROVISIONING_COMPLETED;
      }
 else {
        LOG.debug("Provisioning not complete, trying next template");
      }
    }
    LOG.debug("Provisioning not complete, trying next YAD Cloud");
  }
  LOG.debug("Provisioning not complete, consulting remaining strategies");
  return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES;
}

@ Nonnull @ Override public NodeProvisioner . StrategyDecision apply ( @ Nonnull NodeProvisioner . StrategyState strategyState ) { LOG . debug ( "Applying provisioning." ) ; final Label label = strategyState . getLabel ( ) ; LoadStatisticsSnapshot snapshot = strategyState . getSnapshot ( ) ; for ( DockerCloud dockerCloud : getDockerClouds ( ) ) { for ( DockerSlaveTemplate template : dockerCloud . getTemplates ( label ) ) { if ( notAllowedStrategy ( template ) ) { continue ; } int availableCapacity = snapshot . getAvailableExecutors ( ) + snapshot . getConnectingExecutors ( ) + strategyState . getAdditionalPlannedCapacity ( ) ; int currentDemand = snapshot . getQueueLength ( ) ; LOG . debug ( "Available capacity={}, currentDemand={}" , availableCapacity , currentDemand ) ; if ( availableCapacity < currentDemand ) { Collection < PlannedNode > plannedNodes = dockerCloud . provision ( label , currentDemand - availableCapacity ) ; LOG . debug ( "Planned {} new nodes" , plannedNodes . size ( ) ) ; strategyState . recordPendingLaunches ( plannedNodes ) ; availableCapacity += plannedNodes . size ( ) ; LOG . debug ( "After '{}' provisioning, available capacity={}, currentDemand={}" , dockerCloud , availableCapacity , currentDemand ) ; } if ( availableCapacity >= currentDemand ) { LOG . debug ( "Provisioning completed" ) ; return NodeProvisioner . StrategyDecision . PROVISIONING_COMPLETED ; } else { LOG . debug ( "Provisioning not complete, trying next template" ) ; } } LOG . debug ( "Provisioning not complete, trying next YAD Cloud" ) ; } LOG . debug ( "Provisioning not complete, consulting remaining strategies" ) ; return NodeProvisioner . StrategyDecision . CONSULT_REMAINING_STRATEGIES ; }
do asap provisioning for onceretention with one executor . some other configuration may also want such behaviour ?
