in aliyun-net-credentials/Provider/RefreshCachedSupplier.cs [103:142]
private void RefreshCache()
{
var lockTaken = false;
try
{
lockTaken = Monitor.TryEnter(this.refreshLock, RefreshBlockingMaxWait);
if (lockTaken && (CacheIsStale() || ShouldInitiateCachePrefetch()))
{
try
{
this.cachedValue = HandleFetchedSuccess(this.refreshFunc());
}
catch (Exception ex)
{
this.cachedValue = HandleFetchedFailure(ex);
}
}
}
catch (ThreadInterruptedException)
{
Thread.CurrentThread.Interrupt();
throw new InvalidOperationException("Interrupted waiting to refresh the value.");
}
catch (CredentialException)
{
throw;
}
catch (Exception ex)
{
throw new CredentialException("Failed to refresh credentials.", ex.Message);
}
finally
{
if (lockTaken)
{
Monitor.Exit(this.refreshLock);
}
}
}