Ejemplo n.º 1
0
  private List<BlockDeviceMapping> getNewEphemeralDeviceMapping() {

    final List<BlockDeviceMapping> oldDeviceMapping = getAmiBlockDeviceMappings();

    final Set<String> occupiedDevices = new HashSet<String>();
    for (final BlockDeviceMapping mapping : oldDeviceMapping) {

      occupiedDevices.add(mapping.getDeviceName());
    }

    final List<String> available =
        new ArrayList<String>(
            Arrays.asList("ephemeral0", "ephemeral1", "ephemeral2", "ephemeral3"));

    final List<BlockDeviceMapping> newDeviceMapping = new ArrayList<BlockDeviceMapping>(4);
    for (char suffix = 'b'; suffix <= 'z' && !available.isEmpty(); suffix++) {

      final String deviceName = String.format("/dev/xvd%s", suffix);

      if (occupiedDevices.contains(deviceName)) continue;

      final BlockDeviceMapping newMapping =
          new BlockDeviceMapping().withDeviceName(deviceName).withVirtualName(available.get(0));

      newDeviceMapping.add(newMapping);
      available.remove(0);
    }

    return newDeviceMapping;
  }
Ejemplo n.º 2
0
  protected void addTransientActionsFromBuild(
      MavenModuleSetBuild build, List<Action> collection, Set<Class> added) {
    if (build == null) return;

    for (Action a : build.getActions())
      if (a instanceof MavenAggregatedReport)
        if (added.add(a.getClass()))
          collection.add(((MavenAggregatedReport) a).getProjectAction(this));

    List<MavenReporter> list = build.projectActionReporters;
    if (list == null) return;

    for (MavenReporter step : list) {
      if (!added.add(step.getClass())) continue; // already added
      Action a = step.getAggregatedProjectAction(this);
      if (a != null) collection.add(a);
    }
  }
Ejemplo n.º 3
0
 private void put(String id, String key, String value) {
   synchronized (populateLock) {
     Set<String> strings = map.get(id + "=" + key);
     if (strings == null) {
       strings = new HashSet<String>();
       map.put(id + "=" + key, strings);
     }
     strings.add(value);
   }
 }
Ejemplo n.º 4
0
 public Set<Run> search(@NotNull Iterable<String> ids) {
   Set<Run> result = new TreeSet<Run>(new RunNumberComparator());
   for (String id : ids) {
     Set<String> buildIds = map.get(id);
     if (buildIds != null) {
       for (String buildId : buildIds) {
         Run<?, ?> run = Run.fromExternalizableId(buildId);
         if (run != null) {
           result.add(run);
         }
       }
     }
   }
   return result;
 }
Ejemplo n.º 5
0
 public Collection<Job> getAllJobs() {
   Set<Job> jobs = new HashSet<Job>(getItems());
   jobs.add(this);
   return jobs;
 }