private ConcurrentTaskExecutor resourceBuilderExecutor;
@Override
public List<Resource> create(final GccProvisionContextObject po, int index, List<Resource> resources) throws Exception {
final Stack stack = stackRepository.findById(po.getStackId());
final GccTemplate gccTemplate = (GccTemplate) stack.getTemplate();
final List<Resource> resourcesListTemp = new ArrayList<>();
final String name = String.format("%s-%s", stack.getName(), index);
List<Future<Resource>> futures = new ArrayList<>();
for (int i = 0; i < gccTemplate.getVolumeCount(); i++) {
final int indexVolume = i;
Future<Resource> submit = resourceBuilderExecutor.submit(new Callable<Resource>() {
@Override
public Resource call() throws Exception {
String value = name + "-" + indexVolume;
Disk disk = new Disk();
disk.setSizeGb(gccTemplate.getVolumeSize().longValue());
disk.setName(value);
disk.setKind(((GccTemplate) stack.getTemplate()).getGccRawDiskType().getUrl(po.getProjectId(), gccTemplate.getGccZone()));
Compute.Disks.Insert insDisk = po.getCompute().disks().insert(po.getProjectId(), gccTemplate.getGccZone().getValue(), disk);
insDisk.execute();
GccDiskReadyPollerObject gccDiskReady = new GccDiskReadyPollerObject(po.getCompute(), stack, value);
gccDiskReadyPollerObjectPollingService.pollWithTimeout(gccDiskCheckerStatus, gccDiskReady, POLLING_INTERVAL, MAX_POLLING_ATTEMPTS);
return new Resource(resourceType(), value, stack);
}