Search in sources :

Example 1 with TimeoutException

use of com.emc.vipr.client.exceptions.TimeoutException in project coprhd-controller by CoprHD.

the class TaskUtil method waitForTask.

public static TaskResourceRep waitForTask(RestClient client, TaskResourceRep task, long timeoutMillis) {
    long startTime = System.currentTimeMillis();
    while (isRunning(task) || isSuspended(task)) {
        if (timeoutMillis > 0 && (System.currentTimeMillis() - startTime) > timeoutMillis) {
            throw new TimeoutException("Timed out waiting for task to complete");
        }
        try {
            Thread.sleep(client.getConfig().getTaskPollingInterval());
        } catch (InterruptedException e) {
            throw new ViPRException(e);
        }
        refreshSession(client);
        task = refresh(client, task);
    }
    return task;
}
Also used : ViPRException(com.emc.vipr.client.exceptions.ViPRException) TimeoutException(com.emc.vipr.client.exceptions.TimeoutException)

Aggregations

TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)1 ViPRException (com.emc.vipr.client.exceptions.ViPRException)1