Search in sources :

Example 1 with TaskState

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();
}
Also used : InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) TaskState(com.emc.sa.service.vipr.customservices.tasks.TaskState)

Aggregations

TaskState (com.emc.sa.service.vipr.customservices.tasks.TaskState)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1