use of com.emc.sa.service.vipr.customservices.tasks.TaskState in project coprhd-controller by CoprHD.
the class CustomServicesUtils method waitForTasks.
public static Map<URI, String> waitForTasks(final List<URI> tasksStartedByOe, final ViPRCoreClient client) throws InternalServerErrorException {
if (tasksStartedByOe.isEmpty()) {
throw InternalServerErrorException.internalServerErrors.customServiceNoTaskFound("No tasks to wait for");
}
ExecutionUtils.currentContext().logInfo("customServicesService.waitforTask");
final long startTime = System.currentTimeMillis();
final TaskState states = new TaskState(client, tasksStartedByOe);
while (states.hasPending()) {
states.updateState();
try {
checkTimeout(startTime);
} catch (final InternalServerErrorException e) {
states.printTaskState();
throw e;
}
}
return states.getTaskState();
}
Aggregations