if (shouldTrace) {
client2 = this.getClient().withRequestFilterLast(new ClientRequestTrackingHandler(invocationId)).withResponseFilterLast(new ClientRequestTrackingHandler(invocationId));
}
OperationResponse response = client2.getVirtualMachineDisksOperations().beginDeletingDataDiskAsync(serviceName, deploymentName, roleName, logicalUnitNumber, deleteFromStorage).get();
OperationStatusResponse result = client2.getOperationStatusAsync(response.getRequestId()).get();
int delayInSeconds = 30;
if (client2.getLongRunningOperationInitialTimeout() >= 0) {
delayInSeconds = client2.getLongRunningOperationInitialTimeout();
}
while ((result.getStatus() != OperationStatus.InProgress) == false) {
Thread.sleep(delayInSeconds * 1000);
result = client2.getOperationStatusAsync(response.getRequestId()).get();
delayInSeconds = 30;
if (client2.getLongRunningOperationRetryTimeout() >= 0) {
delayInSeconds = client2.getLongRunningOperationRetryTimeout();
}
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
if (result.getStatus() != OperationStatus.Succeeded) {
if (result.getError() != null) {
ServiceException ex = new ServiceException(result.getError().getCode() + " : " + result.getError().getMessage());
ex.setErrorCode(result.getError().getCode());
ex.setErrorMessage(result.getError().getMessage());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
} else {