@Override protected Tasks<UnManagedVolumeRestRep> doExecute() throws Exception { VolumeIngest ingest = new VolumeIngest(); ingest.setVpool(vpoolId); ingest.setProject(projectId); ingest.setVarray(varrayId); return executeChunks(ingest); }
private Tasks<UnManagedVolumeRestRep> executeChunks(VolumeIngest ingest) { Tasks<UnManagedVolumeRestRep> results = null; int i = 0; for (Iterator<URI> ids = unmanagedVolumeIds.iterator(); ids.hasNext(); ) { i++; URI id = ids.next(); ingest.getUnManagedVolumes().add(id); if (i == INGEST_CHUNK_SIZE || !ids.hasNext()) { Tasks<UnManagedVolumeRestRep> currentChunk = ingestVolumes(ingest); if (results == null) { results = currentChunk; } else { results.getTasks().addAll(currentChunk.getTasks()); } ingest.getUnManagedVolumes().clear(); i = 0; } } return results; }