This question has been asked several months before, so hopefuly the technology evolved
I had someone pull a cable from the ESX server on me during a process that restores a snapshot. I ended up with a client in an infinite IJob Wait. What's the proper way to time all calls out?
Some way to have a non blocking wait with a very long timeout via VIX API? (I am using C# / VixCOM)
I am doing this:
private static void InternalWait(IJob job, int timeoutInSeconds)
{
if (timeoutInSeconds == 0)
{
throw new ArgumentOutOfRangeException("timeoutInSeconds");
}
// active wait for the job to finish
bool isComplete = false;
while (!isComplete && timeoutInSeconds > 0)
{
Check(job.CheckCompletion(out isComplete));
if (isComplete) break;
Thread.Sleep(1000);
timeoutInSeconds--;
}
if (timeoutInSeconds == 0)
{
throw new TimeoutException();
}
}
Manual timer that aborts the thread? I am worried about the consequences and being able to continue or maybe even retry operation.
Something else?
Thx
dB.