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;
}
Aggregations