コード例 #1
0
 private Set<Long> failureCount(List<CloudResourceStatus> failedResourceRequestResults) {
   Set<Long> ids = new HashSet<>();
   for (CloudResourceStatus failedResourceRequestResult : failedResourceRequestResults) {
     if (ResourceStatus.FAILED.equals(failedResourceRequestResult.getStatus())) {
       ids.add(failedResourceRequestResult.getPrivateId());
     }
   }
   return ids;
 }
コード例 #2
0
 private void handleExceptions(
     AuthenticatedContext auth,
     List<CloudResourceStatus> cloudResourceStatuses,
     Group group,
     ResourceBuilderContext ctx,
     ResourceBuilders resourceBuilders,
     Set<Long> ids,
     Boolean upscale) {
   List<CloudResource> resources = new ArrayList<>();
   for (CloudResourceStatus exception : cloudResourceStatuses) {
     if (ResourceStatus.FAILED.equals(exception.getStatus())
         || ids.contains(exception.getPrivateId())) {
       LOGGER.error("Failed to create instance: " + exception.getStatusReason());
       resources.add(exception.getCloudResource());
     }
   }
   if (!resources.isEmpty()) {
     LOGGER.info(
         "Resource list not empty so rollback will start.Resource list size is: "
             + resources.size());
     doRollbackAndDecreaseNodeCount(
         auth, cloudResourceStatuses, ids, group, ctx, resourceBuilders, upscale);
   }
 }